This article needs a technical review. How you can help.
If you're putting together an installer that needs to be able to install extensions for a toolkit-based application, such as Firefox or anything using XULRunner, Gecko 1.9 (Firefox 3) introduces an easy way to do this for Windows, OS X and Linux. Windows users have also had the ability to install extensions using the registry for some time. Now, on OS X and Linux, you can simply copy the extension into a predefined directory on the user's computer.
To install extensions into these directories you must extract the extension to a directory with the same name as the the extension's ID. The ID is defined in the install.rdf of the extension, between the <em:id></em:id>
tags. For WebExtensions based add-ons the ID is the value of the applications.gecko.id
property within the manifest.json file.
In Firefox 4 you may also just copy the extension's XPI to the directory and name it <ID>.xpi as long as the extension does not require extraction to work correctly. If it needs to be extracted/unpacked then you should find a line in the install.rdf file that defines unpack as true (e.g. <em:unpack>true</em:unpack>
). All WebExtensions based add-ons do not require being unpacked.
Windows
Note: Extensions installed to this location will be disabled by default and will be available for all applications with the <appid>.
To install an extension to this location, create a folder with the <appid> in the Extensions folder if it doesn't exist and put your extension folder with the extension's id or proxy file in that folder:
%appdata%\<vendor>\Extensions\<appid>\
For example, for a Firefox extension, that means:
%appdata%\Mozilla\Extensions\{ec8030f7-c20a-464f-9b0e-13a3a9e97384}\{extensionid}\
This location makes the extension only available to a application the profile belongs to:
%appdata%\<vendor>\<appname>\Profiles\<user>\extensions\
%appdata% is a system variable pointing to C:\Documents and Settings\Dave\Application Data\ or C:\Users\Dave\AppData\Roaming\, depending on the Windows version.
OS X
To install an extension to be used by all users on OS X, copy it to:
/Library/Application Support/<vendor>/Extensions/<appid>/
To install an extension just for a specific user, place it in that user's library folder hierarchy:
~/Library/Application Support/<vendor>/Extensions/<appid>/
Linux
To install an extension to be used by all users on Linux, copy it to:
/usr/lib/<vendor>/extensions/<appid>/
Or...
/usr/lib64/<vendor>/extensions/<appid>/
Or...
/usr/share/<vendor>/extensions/<appid>/
To install an extension just for a specific user:
~/.<vendor>/extensions/<appid>/
Example
For example, if you've created a standalone application for OS X that includes a plugin for Firefox, your installer would extract its extensions files to the following folder:
/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/{dba45d40-f69e-11dc-95ff-0800200c9a66}
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" is Firefox's application ID, "{dba45d40-f69e-11dc-95ff-0800200c9a66}" is the extension's ID.
In Firefox 4 if the extension can be installed unpacked then you can just copy the XPI to the directory rather than extracting it:
/Library/Application Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/{dba45d40-f69e-11dc-95ff-0800200c9a66}.xpi
Disabling install locations
In some circumstances you may want Firefox to ignore the additional install locations listed above. In this case you can set the preference extensions.enabledScopes
to a value that defines which locations Firefox will use. Add up the values for the different locations listed below and set the preference to that (note that it is impossible to disable loading add-ons from the profile directory):
Value | Install scope |
1 | The current users's profile. |
2 | All profiles of the logged-in user. |
4 | Installed and owned by Firefox. |
8 | Installed for all users of the computer. |
15 | The combination of all scopes. |
Preventing automatic install from specific locations
Requires Gecko 8.0(Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)Starting in Firefox 8 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5), you can configure Firefox to not automatically install add-ons from the add-on scopes listed in the table in Disabling install locations. Simply set the value of the preference extensions.autoDisableScopes
to the sum of the values for each of the scopes you wish to disable. Setting the value to 0 disables this feature.
Bundling extensions with a custom Firefox
Starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), you can bundle extensions within a customized Firefox, and they will be installed automatically when the user starts up the application for the first time. See Customizing Firefox for details.