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
13
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
  • 357
  • 1
  • 4
  • 10
13
votes
1 answer

Firefox WebExtension API: how to get the URL of the active tab?

Working at migrating my old Firefox extension to the up-to-date Webextension format. Earlier, I was able to get the URL of the active tab in the following way: var URL = tabs.activeTab.url; Now, it doesn't work. I saw some references for…
Racoon
  • 951
  • 3
  • 14
  • 32
13
votes
1 answer

Best way to purge innerHTML from a Firefox Extension

I'm running web-ext lint and getting back a few errors like this: UNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not be set using dynamic values which have not been adequately sanitized.…
mlissner
  • 17,359
  • 18
  • 106
  • 169
13
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,765
  • 4
  • 23
  • 43
13
votes
1 answer

Communicate between scripts in the background context (background script, browser action, page action, options page, etc.)

I am running into an issue sending data from my background script to the script for my pageAction. My content script adds an