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.

1387 questions
76
votes
5 answers

onclick or inline script isn't working in extension

This seems to be the easiest thing to do, but it's just not working. In a normal browser the .html and .js files works perfectly, but in the Chrome/Firefox extension the onClick function is not performing what it's supposed to do. .js file: function…
23
votes
5 answers

Install a personal firefox web extension permanently

Previously, I could write an addon for personal usage packed as something.xpi and I clicked on it to install it. After a while, mozilla introduced xpinstall.signatures.required which you could still get around it. However, it did not stop stabbing…
ar2015
  • 4,338
  • 4
  • 36
  • 83
21
votes
1 answer

How do I see the console.log output of a background script in a Firefox WebExtension?

Does anyone know how to see the output from a console.log() call in a background script? I can see the output from the same in a content script. Here is a simple script that I am testing this with: Here is my background.js: console.log("Message…
21
votes
2 answers

Unrecognized manifest key 'applications'. warning for Google Chrome

I have created my Web Extension for Firefox which uses Chrome Extension API. But Firefox requires application key in manifest.json https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json If I load the same extension for Google…
20
votes
4 answers

Firefox webextension Error: Could not establish connection. Receiving end does not exist

I am trying to send a variable from a background script to a content script that is associated with an HTML page. The content script updates the HTML content with the variable received from the background script. The problem is that I am getting…
17
votes
4 answers

Promise support for Chrome Extensions API?

I've been writing some browser extensions in the last few weeks and until today I thought that a WebExtension for Firefox should work pretty much automatically in Chrome. So I tried to write my code according to Mozilla's examples. But today I…
Forivin
  • 12,200
  • 21
  • 77
  • 171
16
votes
3 answers

Get add-on id of extensions in Firefox

I want to open extensions in browser tab as a normal html page so that I can automate it using selenium WebDriver. In firefox this can be done using link like this - moz-extension://f1b30486-cd88-4319-bbb5-d5e387103414/popup.html. But the problem…
16
votes
4 answers

How to access add-on content script in Firefox console?

I have developed an add-on for Firefox and Chrome. It has content scripts. I want to access them in the browser tab's console (on Firefox the Web Console). For example, I want to enter a global variable defined in the content script(s) in the…
15
votes
3 answers

How to open the correct devtools console to see output from an extension script?

I am trying to test sample code for web extension for browsers. But, it doesn't work. I checked the console for Google Chrome and also for Firefox. It doesn't print anything. The following is my code: manifest.json: { "description":…
14
votes
0 answers

Firefox console: "Error: WebExtension context not found!"

During development of my browser extension I faced with that error. What it could be? I found this message in the source code of Firefox: getContextById(childId) { let context = this.proxyContexts.get(childId); if (!context) { let…
Vitaly Zdanevich
  • 8,667
  • 5
  • 38
  • 64
14
votes
2 answers

Will Safari ever support WebExtensions api?

My web extension works with Chromium browsers, Firefox, Edge, but as I understand - it is impossible now just to open the same codebase with Safari browser?
Vitaly Zdanevich
  • 8,667
  • 5
  • 38
  • 64
13
votes
1 answer

Firefox WebExtensions, get local files content by path

I'm trying to write a small add-on for firefox using the WebExtensions structure. This add-on should read a local file content by it's absolute path: "/home/saba/desktop/test.txt" manifest.json { "manifest_version": 2, "name": "Test -…
Sabaz
  • 3,246
  • 1
  • 14
  • 26
13
votes
2 answers

TypeError: [API] is undefined in content script or Why can't I do this in a content script?

I was trying to write a simple extension in Firefox wherein I modify the X-Frame-Allow header. I looked at the documentation briefly and I see that they support webRequest.onHeadersReceived.addListener(). However, I'm unable to get my code to run…
12
votes
1 answer

Firefox console ReferenceError: browser is not defined

I am trying to learn WebExtension development for Firefox. I find the window debugging tools EXTREMELY useful as I can interactively evaluate javascript code in the window context. For the Webextension APIs at the browser level, I have been totally…
Charles Bisbee
  • 321
  • 1
  • 4
  • 7
12
votes
1 answer

Firefox WebExtension - How to obtain and modify content of cross domain iframe

I would like to know how to access and modify the contents of a cross domain iframe in JavaScript within a Firefox WebExtension. I understand the limitations of normal JavaScript and that modifying a cross domain iframe would be an XSS…
BigBerger
  • 1,595
  • 4
  • 18
  • 41
1
2 3
92 93