简体   繁体   中英

Best way to install a firefox extension on the shell

I want to create a new profile with an addon preinstalled.

What works:

  • run firefox a first time.
  • add the addon.xpi to profile/extensions/addon.xpi .
  • edit profile profile/extensions.ini and add Extension0=/full/path/to/extension.xpi .
  • start firefox again.

What i need:

  • add the addon to profile/extensions/addon.xpi .
  • edit extensions.ini or something similiar.
  • use only relative paths, if possible (seems not to be implemented for extensions.ini)

Finally i want to create a zip file with some firefox preferences/addons, which can be unziped into a profilefolder to create a fresh profile with some preinstalled stuff. For this, it would be important, that everything works with relative paths. If it is definitely not possible, i can add some script to it. But i would prefer some "just unzip" solution.

I think it may be a bit harder, because mozilla wanted to prevent other software from adding toolbars and similiar to firefox by making external addon installation harder. What i already found is the key extensions.autoDisableScopes=0 .

What you can do is open firefox with command line options. And pass the file path to your xpi file, so you don't have to mess with all this internals you are over there.

So do this:

"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "C:\my.xpi"

and on launch it will open a tab and prompt to install your addon.

In the prefs.js:

pref("extensions.autoDisableScopes", 14); // 0x1 not set

See https://developer.mozilla.org/en-US/Add-ons/Installing_extensions#Disabling_install_locations

Then put the addons into extensions/myaddonid.xpi , making sure the filename is the id given in the install.rdf file inside the addon.xpi (zip-)file as <em:id>addon_id</em:id> tag.

On the next start the addons will be silently installed. Some addons needed one restart to work, at least the toolbar buttons were not added on the first start.

Not sure, if this will still work, when firefox decides to allow only addons signed by addons.mozilla.org. On the other hand, they will allow self-hosting addons, as soon as they are signed by AMO, so preinstalling addons downloaded from there will have a good chance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM