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.
Related
I am currently trying to install firefox addons with Ansible.
I found a role for ansible on ansible galaxy, I fixed to work with the latest ansible version (minor python2/3 issue):
Fixed version:
https://github.com/cyborg-x1/ansible-firefox
The Ansible role downloads the xpi file and puts it in the extension folder.
But two issues:
1. Issue
If the .mozilla/firefox/randomString.default-release folder does not exist, it creates it, but then Firefox on the first start creates another directory .mozilla/firefox/randomString.default-release-1 and does not use the directory except selected by profile manager.
2. Issue
The addons are placed in the extension folder, but when starting up they are disabled.
Anoying to do that for > 6 addons.
I tried to to see what changes when I enable the addons by putting a git repo over the ~/.mozilla folder. Multiple files are created the main responsible is a json one where it puts the rights. If I copy that file and just put that in later, it seems NoScript works, but not uMatrix which does not work at all: button with no icon, no reaction when pressing the button.
I also found the way to use /usr/share/mozilla to install addons globally. Problem is, this way, according to documentation, requires to have the addon uid, but that file mentioned (don't recall the name atm) is not present in latest addons of Firefox. So I can not put the appropriate folder name for the addon. Just placing the xpi files there, does nothing at all.
Also on the mozilla docs there is a way mentioned with -install-addon-globally which I tried with firefox executable and the addon file -- no success.
Any Ideas how to solve those issues?
Something that I just need to write in there and they run their installation stuff, what actually seems to be missing when just placing that file.
The first issue could be solved, if I just could run firefox once and close it, then the folder would be there and I can write into it but there is no command line option which terminates firefox after starting, so for Ansible I would need timeout to kill it if it does not return - (I think that's an ugly solution btw)
Any ideas or suggestions?
Thanks for any help!
You can create a firefox installer bundled with the extensions:
https://support.mozilla.org/en-US/kb/deploying-firefox-with-extensions
i have created extension by using crossrider they gave me xpi & crx file which i extracted and want to install manually by copying data to the browser's extension path.
I've read & tried many posts regarding this but they are not helpful because i think some posts are old & not able to find target paths & registry.
like in many posts they say create the following key in the registry here
32-bit Windows: HKEY_LOCAL_MACHINE\Software\Google\Chrome\Extensions
but i couldn't find that on my windows registry & i am using 32bit.
i want something like i copy my extension data to the browser's extension directory & inject some registry value thats all. if it possible then How?
For firefox just add the xpi or unpacked folder to the profile folder. No need for registry so its cross platform.
It can't be automatic as spyware would be all over that. After placing xpi in the extensions folder of the profile, on next startup of Firefox it will prompt saying it found an unauthorized by user add-on, and gives user a chance to enable it, or keep it disabled.
If you want to do it without startup, just launch the file path to the xpi or unpacked folder (if unpacked folder doesnt work, then point it to the install.rdf) in the browser, user will be prompted if they want to install.
There are some registry options though: Install Firefox extension using Windows registry
In Chrome, it's no longer possible to add an extension programmatically on Windows unless the extension is actually published in the Store.
This is for security reasons: previous registry-based (and otherwise) methods were open to malware abuse.
If your extension is published in the store, you can add it semi-automatically via registry. The user will still be asked whether to enable it on the next load.
You can also install extensions silently using Enterprise policy (only if the machine is part of a Windows domain and you have admin rights on the domain policy), on other OSes, or load it unpacked for testing with the --load-extension command line switch (will not persist after Chrome is restarted).
In Chrome go to
chrome://extensions
Enable Developer Mode at the top and click on the button to load an extracted extension.
I am developing an extension for Mozilla Firefox. Is there any way in which I can develop without packing the files into an xpi for every change I make (like in Chrome)?
Yes. To do this, first close Firefox.
Then create a file in your profiles extensions directory that has the same ID as your extension.
In that file, you should place the fully qualified path to where you are developing your extension. In particular, to the same directory as the install.rdf.
When Firefox is restarted, it should ask you if you want to install the extension. Once you've done that, the extension will run from the local copy. After you make changes, you just need to close and restart the browser.
For more information, check this page out:
https://developer.mozilla.org/en-US/docs/Setting_up_extension_development_environment
I also recommend you install the Developer Assistant - https://addons.mozilla.org/en-US/firefox/addon/extension-developer/ - which will set some prefs that make it easier to create Firefox extensions.
I am following the instructions here to make my development environment for firefox:
https://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/
and everything is working great.
On the page as you can see there is one instruction:
Point your Firefox extensions directory to your extension
Instead of constantly preparing and
reinstalling your extension, there’s a
simple way to add a pointer from your
Firefox extensions directory to your
code location. To do this, you must
first find your profile directory: ...
And that too is working great!
My question is:
When I make changes to the JS file in the dev directory, do I have to keep restarting FF for the changes to take effect? Because when I create an extension in Chrome there is a simple link that says "reload" and clicking that reloads the extension without me needing to restart the browser... does any such functionality exist for FF?
Thanks!
R
Extension Developer extension has an option to reload chrome. Doing that should reload your extension without restarting Firefox.
It really depends on the JavaScript files. XPCOM components and JavaScript modules load only once, there you unavoidably need to restart when you change them. JavaScript files loaded via <script> tags are only valid for the window that loaded them - opening a new window will do to load a fresh copy of the script. All that will only work correctly if -purgecaches command line option is specified as other people noted already.
If I install and then uninstall our extension through the registry everything works fine.
But if I install it through the registry and then uninstall it through the browser extensions page the browser remembers it and i can't reinstall it through the registry even if I remove it and then try to reinstall it through the registry.
The only way I can have the extension reinstalled is to add it manually to the extensions page. But, I don't want my users to have to do it manually. Is there a way to force install it again?
Thanks,
Ben
I found a solution to the problem. But, I decided not to use it because I decided it is a good idea not to force installation after the user removed the extension.
Just thought that you will want to know the solution:
Turn off your Google Chrome browser go to the 'Preferences' file under:
c:\users\\AppData\Local\Google\Chrome\User Data\Default
there find your extension under "{Guid}" then delete everything from "{guid}" (included) to the close '}' and then save and start your browser. this hack will force chrome to check again for extensions and your extension will be on again.
I respect the Chrome policy to make the extension blacklisted in this case until the user manually adds it back through Chrome Extensions page UI. However there is another tweak available:
If you are using windows, open the 'Preferences' file in: "C:\users\AppData\Local\Google\Chrome\User Data\Default".
This is a JSON file. Look for your extension id (Guid) key with object value section. Changing the value of 'state' property from 2 to 1 in your extension Guid values section will force chrome to bring back your extension once you start chrome browser.
Note: The chrome browser must be closed completely before modifying this file.