|Paradigm(s)||Declarative (markup language)|
|Influenced by||HTML, XML|
XUL (// ZOOL), which stands for XML User Interface Language, is a user interface markup language that is developed by Mozilla. XUL is implemented as an XML dialect; it allows for graphical user interfaces to be written in a similar manner to Web pages.
XUL can be used to write cross-platform applications such as Mozilla Firefox, where it is interpreted by the layout engine known as Gecko which renders Firefox's user interface and Web page display.
XUL has no formal specification and does not inter-operate with non-Gecko implementations. However, it uses an open source implementation of Gecko, that was tri-licensed under the GNU GPL, GNU LGPL, and MPL until Gecko upgraded to GPL-compatible, MPL 2.0.
Programmers typically define a XUL interface as three discrete sets of components:
- content: the XUL document(s), whose elements define the layout of the user interface
- skin: the CSS and image files, which define the appearance of an application
- locale: the files containing user-visible strings for easy software localization
XUL defines a wide range of elements, which roughly belong to the following types:
- Top-level elements
- window, page, dialog, wizard, etc.
- label, button, text box, list box, combo box, radio button, check box, tree, menu, toolbar, group box, tab box, colorpicker, spacer, splitter, etc.
- Box model
- box, grid, stack, deck, etc.
- Events and scripts
- script, command, key, broadcaster, observer, etc.
- Data source
- template, rule, etc.
- overlay (analogous to SSI, but client-side and more powerful, with higher performance), iframe, browser, editor, etc.
While XUL serves primarily for constructing Mozilla applications and their extensions, it may also feature in Web applications transferred over HTTP. The Mozilla Amazon Browser, a former XUL application of this type, provided a rich interface for searching books at Amazon.com.
However, many of the powerful features of Mozilla (such as privileged XPCOM objects) remain unavailable to unprivileged XUL documents unless the script has a digital signature, and unless the user obtains grants of certain[which?] privileges to the application. Such documents also suffer from various limitations of the browser, including the inability to load remote XUL, DTD, and RDF documents.
As Gecko provides the only full implementation of XUL, such applications remain inaccessible to users of browsers not based on Mozilla. Mozilla-programmers sometimes refer to XUL applications running locally as chrome.
Other applications using XUL include:
- The ActiveState Komodo IDE uses XUL as well as the Open Komodo project announced in 2007.
- The Songbird music-player and Miro video-player both use built-in XUL.
- The Elixon WCMS/XUL Content management system uses exclusively remote XUL, thus overcoming some of the aforementioned limits of remote unprivileged XUL documents.
- The developers of the Celtx media pre-production application used XUL.
- The Flickr Uploadr was built using XUL.
- Kiwix, the offline Wikipedia-viewer
With the release of Firefox 4, support for remote XUL was disabled by default, due to security concerns. Loading an XUL page via HTTP would now display an error unless the domain was added to a hidden whitelist.
The name "XUL" references the film Ghostbusters (1984), in which an ancient Sumerian deity called Zuul possesses the character Dana Barrett and declares, "There is no Dana, only Zuul". Since XUL, like MXML, uses XML to define an interface rather than a document, its developers adopted the slogan: "There is no data, there is only XUL". Hence the XML namespace URI at the beginning of every XUL document:
The linked document displays the slogan in large letters in the center of the screen.
This example shows three buttons stacked on top of each other in a vertical box container:
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="vbox example" title="Example 3...." xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox> <button id="yes1" label="Yes"/> <button id="no1" label="No"/> <button id="maybe1" label="Maybe"/> </vbox> </window>
- Extensible User Interface Protocol (XUP)
- User interface markup language
- Layout manager
- Mozilla application framework
- ZK Framework
- "Gecko FAQ". Mozilla Developer Center. Mozilla Foundation. 2008-03-15. Retrieved 2009-03-26.
- Mozilla Foundation. "Mozilla Code Licensing". Retrieved 2007-09-17.
- "The Joy of XUL". Mozilla Foundation. 2007-09-09. Retrieved 2009-03-26.
- Firefox 3 for developers
- "Remote Application Development with Mozilla, Part 2: A Case Study of the Mozilla Amazon Browser (MAB)". Oreillynet. 2003-02-05.
- Feldt, Kenneth C. (2007). Programming Firefox: Building Rich Internet Applications with XUL. O'Reilly Media. pp. 76–77. ISBN 0-596-10243-7. Retrieved 2008-03-04.
- "Firefox 4 for developers".
- XUL documentation on developer.mozilla.org
- XUL Periodic Table — Visual demonstration of XUL capabilities (requires a Gecko-based (XUL-enabled) browser such as Mozilla Firefox)