Firefox Extensions (and Microsoft Edge)

Writing Firefox extensions is now noted to not be as difficult as before. I had never written one, anyway. Evidently, Firefox used to have a complicated scheme for extensions, but has taken on the same model for extensions as Google Chrome uses. The technology is called Web Extensions and is now mostly portable across the browsers: Chrome, Opera, Firefox and Microsoft Edge (Windows 10). I say mostly portable as there are some non-implemented API calls in various browsers but if you avoid those the same extension should work in all 4 browsers. But alas, not Safari! When using an API call you can check that it is implemented across all the browsers. For example, for the API browser.tabs.create which creates a new tab in the browser, you can see in the API documentation there are slight differences:

One disappointment in Firefox is it does not notify the user of the permissions being requested by an extension on install. In the Chrome Store for the Fox Forum Extension you can see before install that this extension has permissions only to modify information on pages navigated to Fox News:

Here is an example of installing an extension in Firefox, it’s called Tab Memory Usage, so it obviously needs access to all the tabs in the browser, as compared to the Fox Forum Extension which only needs access to the activeTab and only when it is navigated to Fox News, but there is no mention of what permissions this extension is requesting! (The “learn more…” button just takes you to general information about installing extensions).

What you can do is to right-click the Add to Firefox button and save the extension as a file and then unzip it, extensions are simply zip files, and look in the manifest to see what permissions are being requested. Still kind of weak on the part of the Firefox Store to not make that obvious before someone adds an extension.

One nice thing about Firefox over Chrome is that you can have unsigned extensions loaded without the nagging Chrome gives you about that when you open it.

For aspiring extension writers I found a good book on the subject, Creating Google Chrome Extensions by Prateek Mehta. Since the technology is now portable it applies to the other browsers too. The samples for the book are also located on GitHub.