Powered by coANDco UK

How to create a firefox extension

From How2s

Getting Started

First of all, setup your environment so you can easily develop. Yous still will have to restart your browser very often but at least don't need to package and install the files every time. To do so, follow these simple steps:

  • start firefox with the switch -ProfileManager
  • create a new profile just dedicated to the developer environment

That's it! now you gotta get an XPI dummy you can start work on. Therefore go to the Firefox/Thunderbird Extension wizard and enter your data: http://ted.mielczarek.org/code/mozilla/extensionwiz/

There is also an extension suite, which helps you developing Firefox extension. Find it on https://addons.mozilla.org/en-US/firefox/addon/7434

You can now extract the ZIP file to any random folder and follow the instructions of the README file within the zip file.

It is also recommended to set up the extensions and change the variables mentioned in http://developer.mozilla.org/en/docs/Setting_up_extension_development_environment

You probably don't want to build and install your extension whenever you make a change. Instead you just want to save the file and see the effect in the browser. Unfortunately it's not *that* convenient yet. You still have to restart Firefox after every change (the "reload chrome" functionality in the extension developer extension didn't work reliably for me) .

In order to link your working folder with the firefox extension in Firefox, you need to add the path of your working folder to the file you will find in

/Users/johndoe/Library/Application Support/Firefox/Profiles/9psgruwx.developer/extensions

(Mac). There you have to put a text file which is called the same as the UID of the app (e.g. myapp@johndoe or even {c45c406e-ab73-11d8-be73-000a95be3b12} which is however more cryptic) You would put something in like

/Users/johndoe/Documents/Dev/Firefox Extensions/myapp/v0.01/myapp

followed by a carriage return.

Building the XPI

  • go to the dicrectory containing all the files
  • zip the file up using
zip -r ../myapp *
  • rename myapp.zip to myapp.xpi
  • try to install it to Firefox
Please check out our sponsor, thanks to whom How2s.org is FREE: