An Extension changes the way your application behaves in some way. IÕm going to talk about Firefox Extensions here –these extensions change the way the browser works in some way, either by doing something to adjust web page content, or adjusting the browser UI to make certain tasks more efficient.

For any of those reasons, the extension needs to ÒhookÓ its code into the browser window somehow, and the easiest way is to use XUL overlays.

XUL overlays allow other XUL documents to have their DOMs ÒmergedÓ into the DOM of another XUL document (called the ÒmasterÓ). In the case of Firefox, the ÒmasterÓ is the browser window XUL file – browser.xul. An extension that adds a menu item would specify its menu item in an overlay in such a way that it was merged into the appropriate menu in the Firefox window.

XUL Overlays can also include <script> tags that load script files supplied by the extension, which can add event handlers and interactivity to UI added using the overlay merging system IÕve just described, make modifications to web page content (like the Greasemonkey Extension, for example), and so on.