Why use XUL?
The XML User Interface Language (XUL) is a markup language for creating rich dynamic user interfaces. It is a part of the Mozilla browser and related applications and is available as part of Gecko. It is designed to be portable and is available on all versions of Windows, Macintosh as well as Linux and other Unix flavours. With XUL and other Gecko components, you can create sophisticated applications without special tools.
What is XUL?
XUL is an XML language and you can use numerous existing standards including XSLT, XPath and DOM functions to manipulate a user interface, all supported directly by Gecko. In fact, XUL is powerful enough that the entire user interface in the Mozilla application is implemented in XUL.
In addition to the many built-in user interface widgets available in XUL, you may create additional custom widgets using a related language called the Extensible Bindings Language (XBL). This language may be used to create custom tags and implement custom functionality.
XUL applications may be either opened directly from a remote Web site, or may be downloaded by the user and installed. Mozilla's XPInstall technology allows an application to be placed on a remote site and installed using only a couple of clicks of the mouse. No searching though the file system for an installer or stepping through a lengthy install process. The benefit of installing an application is lowered security restrictions so that applications may read and write files, and access user preferences and system information.
XUL may also be used to create standalone applications that embed the Gecko engine or may be used as part of the browser. A feature in XUL called an overlay allows a third party to create extensions to the browser itself, for example to add a custom toolbar, change menus, or add other features. This feature is popular in Mozilla Firefox -- there are almost 100 extensions available. Mozilla's upcoming mail client Thunderbird also has a number of extensions available. In fact, any XUL application can support extensions.
Gecko also supports various Web Services technologies such as XML-RPC, SOAP and WSDL. These technologies have been used recently to create an application to browse for products on amazon.com.
Standards and other Technologies Supported
The following is a list of technologies supported by Gecko and can be used by XUL applications (not including XUL itself):
- HTML 4.0 and XHTML
- CSS2 and some of CSS3
- DOM2 and some of DOM3
- Simple XLinks
- XML Base
- SOAP (Simple Object Access Protocol)
- WSDL (Web Services Description Language)
- XBL (eXtensible Bindings Language)
- GIF, JPG, PNG, BMP, ICO images
- HTTP 1.1
This list doesn't include all of the mail related features used by Mozilla Mail which you could also use in your own application to support POP3, IMAP and LDAP.
XUL as an Application Platform
XUL and Gecko make an excellent choice for building sophisticated Web applications. It provides a rich user interface toolkit, an HTML and CSS renderer with excellent standards-compliance and support for web services, all completely cross platform.
Work is ongoing with the Gecko Runtime Environment (GRE), which aims to make Gecko a snap to drop into a standalone application, complete with your own executable, if you desire. The idea is to allow the right version of the GRE to be installed automatically with the application if necessary. If the GRE is already installed, there is no need to install it again, or even download it. For those that are interested, the GRE is about 5 to 10 MB, depending on your platform, which is quite small compared to other application platforms. It's also possible to have Gecko run directly from a network drive or CD.
Since XUL may be used on Web sites, it can be used with server-side architectures such as PHP and JSP to build dynamic content. This allows Gecko to be both a two-tier or a three-tier application model depending on your needs. There are projects in development now which aim to integrate Java, Python and other languages into Gecko directly.
Where to Start?
XulPlanet provides tutorials and references on XUL, XBL and other related technologies. There is also information from mozilla.org. For complex examples, you can try any of the various Mozilla Firefox extensions, projects on mozdev.org or even the XUL used by the Mozilla applications themselves. Just open the files with a JAR extension in Mozilla'a chrome directory using a ZIP utility and take a look at the files.
To start learning XUL, begin the XUL tutorial.
Or, learn more about XUL and related technologies.