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.

XUL was designed for creating the user interface of the Mozilla application including the web browser, mail client and page editor. XUL may be used to create these types of applications. However, it may also be used any place you would currently use a web application, for instance, when you need to be able to retrieve resources from the network and require a richer user interface. Like HTML, in XUL you can create an interface using a markup language, use CSS style sheets to define appearance and use JavaScript for behavior. You also have access to programming interfaces for reading and writing to remote content over the network and for calling web services. Unlike HTML however, XUL provides a rich set of user interface widgets for creating menus, toolbars, tabbed panels, and hierarchical trees to give a few examples.

This means you don't have to look for third party code or include a large block of JavaScript in your application just to handle a popup menu. XUL has all of these elements built-in. In addition, the elements are designed to look and feel just like those on the user's native platform, even supporting OS level themes in Windows XP and MacOS X. Or, if you prefer, you can use standard CSS to create your own look. The XUL widgets also support localization and have support for accessibility using OS level accessiblity interfaces.

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):

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.

Copyright © 1999 - 2005 XULPlanet.com