Apr 07 2010
Firefox extensions are distributed in XPI packages (pronounced zippy).
XPI packages are in reality just a ZIP file with a standard file and folder structure in it.
Two types of add-on installations can be performed : Per-user, and per-workstation (Global). Typically, extensions are installed per-user, especially if the user is not a local administrator on his workstation.
However, there may be cases where a global installation is preferred: a standard extension would need to be installed multiple times for every user of a shared workstation. It would also be harder to push extensions out to users instead of machines.
Here is how to create install a firefox extension globally in a way that can easily be packaged with anything that allows running batch files. The same information can easily be used to create clean MSI packages as well, using WiX or anything else, just put the files in the right location and set the proper registry keys. It would probably be more reliable to do it with an MSI than batch files.
1) Obtain the XPI package
2) Unzip the XPI package
3) Open the install.rdf file in the package.
We need to identify the “ID” of the package. Look for something similar to this:
<em:id>Blah blah</em:id>
The ID contained in the EM:ID anchors may be a name or a GUID. Note it down.
4) Create a registry import file
Create a .reg file.
This will be used to tell Firefox where to look for the new globally installed extension. This can be anywhere you want as long as the user that will open firefox has read access to it.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox\Extensions]
“em-id-of-extension”=”C:\\Program Files\\Mozilla Firefox\\PathToExtension”
5) Create a registry import file for uninstallation
This file needs to be identicaly to the above, but with a minus instead of the path to the extension. This simply deletes the string we created before.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Firefox\Extensions]
“em-id-of-extension”=-
6) Create a batch file for installation
This batch file simply needs to copy the files to the location you specified in your .reg file, and then run regedit /s regfile.reg to import the registry changes.
7) Create a batch file for uninstallation
This batch file simply deletes the directory containing your extension and runs regedit /s on the uninstallation regfile.