O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #68. Make Applications and Extensions with XUL

Make an application rather than a web page by filling a Firefox window with XUL.

Many books have been written on the craft of making web pages with HTML, and this hack won't cover that broad category. Crafting whole XUL applications (or extensions , which are application pieces) is a similar process. XUL can run standalone (as discussed in this hack) or mixed with HTML [Hack #60] . There is extensive source material on XUL development. Chapter 7 and Chapter 8 in this book explain how to deploy or install XUL content once it's created. This hack offers a first taste of the XUL tags that can go into such content.

XUL describes user interface elements such as menu bars and scrollbars, just as XHTML describes links and paragraphs of text. It addresses a problem space that HTML is not ideally designed for. It allows record management, content management, control systems, and other nontextual applications to run over the Web without having to bend hypertext content into shape to do it.

Make and Display an XUL Demo

The following document is the start of an XUL-based application. It should be stored in a file with a .xul extension, such as test.xul:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<?xul-overlay    href="chrome://example/content/extras.xul"?>
<window 
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  title="Example App" 
>

  <script src="chrome://example/content/example.js"/>
               <stringbundle ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required