Developer Mozilla Foundation Platform Gecko License MPL | Implementation language C++ OS Cross-platform | |
Paradigm Declarative (markup language) |
XUL (/ˈzuːl/ 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.
Contents
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.
In August 2015, Mozilla announced that the use of XUL for creating Firefox add-ons would be deprecated in the future in favour of WebExtensions. Pale Moon, a fork of Firefox, will continue to support XUL indefinitely.
Design
XUL relies on multiple existing Web standards and Web technologies, including CSS, JavaScript, and DOM. Such reliance makes XUL relatively easy to learn for people with a background in Web programming and design.
XUL has no formal specification and does not inter-operate with non-Gecko implementations. However, it uses an open-source implementation of Gecko which Mozilla tri-licensed under the GNU GPL, GNU LGPL, and MPL until Gecko changed to GPL-compatible, MPL 2.0.
Mozilla provides experimental XULRunner builds to let developers build their applications on top of the Mozilla application framework and of XUL in particular.
XUL provides a portable definition for common widgets, allowing them to move easily to any platform on which Mozilla applications run.
XUL documents
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 elements
XUL defines a wide range of elements, which roughly belong to the following types:
One can use elements from other applications of XML within XUL documents, such as XHTML, SVG, and MathML.
Mozilla added some common widgets — <scale/>
(sometimes called "slider"), <textbox type="number"/>
(spinbox), time and date pickers — during the Gecko 1.9 development cycle.
XUL applications
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 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:
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.
Example
This example shows three buttons stacked on top of each other in a vertical box container:
Similar languages
Based on HTML, DHTML, and JavaScript, Microsoft's HTML Application resembles XUL as it provides a stand-alone capability to run applications on Windows, outside a Web browser.
The Microsoft Windows Presentation Foundation (WPF) defines XAML, another declarative UI language similar to XUL — it runs on top of the .NET Framework stack.
JavaFX defines FXML as its own declarative UI language like XUL.