Extending Firefox and Thunderbird
Written by Mike James   
Saturday, 20 June 2009
Article Index
Extending Firefox and Thunderbird
Getting started
Hello Toolbar
Trying it out
Debugging
XPCOM

Zippy

The first hurdle in creating an extension is implementing the way that the code is bundled into a zip file or "bundle" with the extension xpi (pronounced "zippy"). A fixed folder structure is used so that Firefox can find the information it needs to install the extension automatically. This is a good idea but the structure is complicated and getting it right can be difficult. The simplest solution is either to download an existing extension and unzip it or to use the online Extension Wizard at:
http://ted.mielczarek.org/code/mozilla/extensionwiz/
However you create the .xpi file you will need to provide some basic information about your application. If you use the Wizard you simply fill in a form and it generates a ZIP file that you can then download to a project directory. A ZIP file for this "Hello World" project is included on the cover disc as helloworld.zip. To work with the project all you have to do is unzip this file which creates all the folders and template files you need to work with.
Wizard
An easy way to generate an xpi file for the project


If you open the project's main folder - helloworld in this case - you will discover a number of files and subfolders which you can investigate as you learn more about building extensions. They are all well documented on the Mozilla website. At this stage the only folder you need to worry about is Content and two files it contains: firefoxOverlay.xul, the XUL user interface definition, and overlay.js, the JavaScript code for your extension.



Last Updated ( Saturday, 27 June 2009 )