Questions tagged [firefox-addon-webextensions]

WebExtensions are a way to write Firefox extensions that are compatible with other browsers such as Google Chrome and Opera. Microsoft plans to bring support to their Edge browser soon. Questions requiring a MCVE (i.e. debugging questions) should include your manifest.json file in addition to all other files needed to duplicate the problem.

WebExtensions are a new way to write Firefox extensions. It is available in all current versions of Firefox (version 48.0+).

The WebExtensions API is designed for cross-browser compatibility. To a large extent, the API is compatible with the extension API supported by Google Chrome and Opera, with Microsoft Edge following soon.

The documentation for Firefox WebExtensions can be found at MDN :: Add-ons - WebExtensions.

The WebExtensions API is under active development. What is supported improves in each newer version of Firefox. You should pay attention to the Browser Compatibility section on the API documentation page for any part of the API you are using to verify the portions of the API you are using are supported in the version of Firefox you are using. You may want to strongly consider testing your extension with either Firefox Developer Edition, or Firefox Nightly.

Minimal, Complete, and Verifiable Examples will almost always need a manifest.json file in order to be complete, in addition to any other files needed. The manifest.json file contains key information which is necessary in many situations to determine why an extension is not working.

For more information on Firefox Add-on types see the full documentation on Mozilla Developer Network: Add-ons.

1541 questions
5
votes
2 answers

Is it possible to use external js in a Firefox Extension? e.g. Jquery from CDN

I can't find any reference in the docs to using external js in the Firefox WebExtensions APIs. Most related Stack Overflow questions are about the old/legacy Add-on SDK. I'm asking about the new WebExtensions APIs Is it possible? For example, can…
43Tesseracts
  • 4,617
  • 8
  • 48
  • 94
5
votes
1 answer

Execute javascript in Firefox extension popup

I am currently taking my very first steps in extension development. At the moment I'm just trying to display some info in a popup that appears when I hit the button. The problem is that it is dynamic information, that I gather from a JSON-file on…
Discoverer
  • 51
  • 1
  • 6
5
votes
0 answers

Set focus in webextension popup

So I am writing a simple webextension for Firefox. It uses a browserAction popup to get some data from the user. This data is entered into a textArea element. It would be convenient for the user if the textArea element had focus when the popup…
Nick
  • 258
  • 1
  • 3
  • 7
5
votes
1 answer

How to store Greasmonkey 4 Scripts in git

With the new update to Firefox 57 and Greasemonkey 4.0 it seems that the gm_scripts folder is no longer where the user.js scripts are stored. Where are the scripts stored now? Any suggestions for keeping these scripts in git?
Rob
  • 3,687
  • 2
  • 32
  • 40
5
votes
1 answer

webextension: Why does the browser add a trailing slash to the requested URL?

When I make a request to http://www.example.com, why does I see http://www.example.com/ in the webRequest.onBeforeRequestListener? For example: chrome.webRequest.onBeforeRequest.addListener( details => console.log('Sending request to',…
5
votes
1 answer

Firefox Web Extensions APIS for Multiple Monitor and Full Screen

Firefox Quantum finally released on November 14, 2017. Quoting from this link: In the past, you could develop Firefox extensions using one of three different systems: XUL/XPCOM overlays, bootstrapped extensions, or the Add-on SDK. By the end of…
5
votes
0 answers

chrome.webRequest and safari

I'm trying to port a Chrome/Firefox extension for Safari. But the extension use a lot a feature of those browsers that doesn't seem to exist in Safari : chrome.webRequest (https://developer.chrome.com/extensions/webRequest). The chrome.webRequest…
5
votes
2 answers

How do I view and edit local storage used by WebExtensions based Firefox addon?

So I am developing a WebExtensions based add-on for Firefox. My add-on successfully stores and later retrieves some cruft (using browser.storage.local.set()/get(). But how can I view and edit the contents interactively (using keyboard and mouse),…
user2895783
5
votes
1 answer

The best practice to detect whether a browser extension is running on Chrome or Firefox?

I have written a Chrome extension and I am migrating it to other browsers like Firefox and Edge. However, the WebExtensions API on Firefox has some differences compared to Chrome's API. So I have to detect whether I should use callback-style APIs…
5
votes
1 answer

Firefox web extension change url of new tab addon

I have built a web extension addon for Firefox and Chrome. In Chrome, the address bar is empty, which is why I want Firefox too. If I click on "new tab", the following URL is set on the address bar:…
nutzt
  • 2,773
  • 3
  • 17
  • 26
5
votes
1 answer

How can a (Firefox) WebExtension know its own version?

I'm porting a legacy Firefox extension to WebExtensions. I want to know at run time the version number of the extension itself. Right now I'm doing: let extensionVersion = (function() { var xhr = new XMLHttpRequest(); …
arantius
  • 1,715
  • 1
  • 17
  • 28
5
votes
3 answers

How to install my own firefox extension

I am new to FF extensions development. I work on Windows OS. I am using web extensions. I started my first extension. I created a directory in My Documents which contains my extension files. The files are based on the example in: Your First…
user7945230
  • 1,075
  • 2
  • 13
  • 20
5
votes
0 answers

How to implement firefox Web-extensions Push notifications

Forgive me if you think its an obvious one, but I didn't find any relevant(non-obsolete) material on the same. So, I have a chrome extension out there (Zoho Mail Tracker) which as the name suggests is an email tracker for the Zoho mail client. It…
5
votes
2 answers

Stop window.location execution in global context

I want to stop execution of window.location as in below when a page loads: I'm able to bypass alert message by replacing alert function during…
user5858
  • 1,082
  • 4
  • 39
  • 79
5
votes
1 answer

Firefox Webextension - TypeError: browser.contextMenus is undefined

I refer to https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/onClicked. I have used the code in this example for testing in my background-script.js but this code seems not to work properly like so much other webextension…
Pmel
  • 83
  • 8