Chapter 9. Extending the Interface

Up to this point, we have discussed techniques to build a standalone application based on the XUL interface. We now turn our attention to extending the existing Firefox browser interface to add functionality to the standard browser.

In this chapter, we will add elements to the browser interface by using XUL overlay files to add a new document styling feature. We will then use the XML Bindings Language (XBL) to add JavaScript behaviors to a custom interface widget that monitors XMLHttpRequest objects. Finally, I’ll demonstrate the use of “hidden” widgets, known as anonymous content, to display return results from the asynchronous server request.

This chapter discusses:

  • The background of overlay files

  • Developing reusable overlays to be deployed from the chrome directory

  • Attaching overlays to the browser interface

  • Building processing logic into the overlay

  • Implementing a custom widget described by XBL

Overlay Files

It is not uncommon for a designer to develop a collection of interface widgets that perform a common function. Dialogs that prompt users for confirmation, data entry, or file selection are examples of both interface elements and underlying logic that may be shared.

The next few pages will explore the development of a reusable interface that will change the color and size of an entire class of HTML tags for a document as part of an interactive session (a function that may be useful for web page design applications). The first step in such a development ...

Get Programming Firefox now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.