Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox add-ons: how to install my own local add-on (extension) permanently in Firefox?

I have my own browser extension with some personal website customizations. Works fine in Chrome, but doesn't work in Firefox.

Unlike Chrome, it seems Firefox can't install unpacked extensions or add-ons. Only in debug mode I can do Load Temporary Add-on, select the folder with my extension, and that works OK. Except that's just temporary.

When I pack the extension by putting the files in a .zip (not within a subdirectory or anything, the archive just directly contains the files) and rename it to .xpi, and then choose Install Add-on from file and select my .xpi, it says:

The add-on downloaded from this site could not be installed because it appears to be corrupt.

While troubleshooting, I made a minimal dummy extension which doesn't do anything, consisting only of a manifest.json and dummy.js file. Then pack that from the command line using 7z a -tzip test.xpi in that directory, which creates my zip file called test.xpi containing the two files. Loading that extension in Firefox give the error above.

For your reference here is my manifest.json:

{
  "manifest_version": 2,
  "name": "Test Extension",
  "version": "1.0",
  "description": "Dummy Text Extension",
  "content_scripts": [
    {
      "matches": [ "*://*/" ],
      "js": ["dummy.js"]
    }
  ]
}

And the content of dummy.js is:

// this file is intentionally left blank

Again: works fine in Chrome, works fine in Firefox when loading as temporary add-on in debug mode (i.e. by loading the files, in the open dialog I select the manifest.json file). But loading the .xpi to install this extension permanently results in the "appears to be corrupt" error.

FYI: I'm using the latest versions of Chrome and Firefox on macOS 10.15.5.

For testing purposes, here is the exact test.xpi file I created, but packing it manually as decribed above will give the same result.

like image 840
RocketNuts Avatar asked Jun 06 '20 19:06

RocketNuts


People also ask

How do I manually install Firefox extensions?

Method: Press Alt + f > o > browse to the extension > double click the extension (or select Open) > Install Now. Method: Drag the extension to the instance of Firefox on the taskbar > wait for Firefox to appear > drop onto the browser window > Install Now.

How do I enable private Add-ons in Firefox?

Underneath the description of the extension, you will see extension settings. Next to Run in Private Windows, select Allow to enable the extension to work in private browsing or select Don't Allow to disable it in private browsing.


Video Answer


1 Answers

Did you try the web-ext tool and sign your add-on? You can use the Web-ext CLI tool to sign and install on your firefox.

  • Install web-ext tool from here -> https://github.com/mozilla/web-ext
  • Run web-ext sign, this will sign your addon for installation
like image 84
Santosh Avatar answered Sep 24 '22 21:09

Santosh