The Browser support for JavaScript APIs page includes compatibility tables for all APIs that have any support in Firefox. Where there are caveats regarding support for an API method, property, type, or event, this is indicated in these tables with an asterisk "*". Selecting the asterisk expands the table to display a note explaining the caveat.
The tables are generated from compatibility data stored as JSON files in GitHub.
The rest of this section describes the main compatibility issues you may need to consider when building a cross-browser extension. Also, remember to check the browser compatibility tables, as they may contain additional compatibility information.
Notifications API
For notifications.create()
, with type "basic"
:
- In Firefox:
iconUrl
is optional.
- In Chrome:
iconUrl
is required.
When the user clicks on a notification:
- In Firefox: The notification is cleared immediately.
- In Chrome: This is not the case.
If you call notifications.create()
more than once in rapid succession:
- In Firefox: The notifications may not display. Waiting to make subsequent calls within the
notifications.create()
callback function is not a sufficient delay to prevent this.
Proxy API
Firefox and Chrome include a Proxy API. However, the design of these two APIs is incompatible.
Tabs API
When using tabs.executeScript()
or tabs.insertCSS()
:
- In Firefox: Relative URLs passed are resolved relative to the current page URL.
- In Chrome: Relative URLs are resolved relative to the extension's base URL.
To work cross-browser, you can specify the path as an absolute URL, starting at the extension's root, like this:
/path/to/script.js
When calling tabs.remove()
:
- In Firefox: The
tabs.remove()
promise is fulfilled after the beforeunload
event.
- In Chrome: The callback does not wait for
beforeunload
.
WebRequest API
- In Firefox:
- Requests can be redirected only if their original URL uses the
http:
or https:
scheme.
- The
activeTab
permission does not allow for intercepting network requests in the current tab. (See bug 1617479)
- Events are not fired for system requests (for example, extension upgrades or search bar suggestions).
- If an extension wants to redirect a public (e.g., HTTPS) URL to an extension page, the extension's
manifest.json
file must contain a web_accessible_resources
key with the URL of the extension page.
Note: Any website may link or redirect to that URL, and extensions should treat any input (POST data, for example) as if it came from an untrusted source, as a normal web page should.
- Some of the
browser.webRequest.*
APIs allow for returning Promises that resolves webRequest.BlockingResponse
asynchronously.
- In Chrome: Only
webRequest.onAuthRequired
supports asynchronous webRequest.BlockingResponse
by supplying 'asyncBlocking'
, through a callback instead of a Promise.
Windows API
- In Firefox:
onFocusChanged
of the windows
API triggers multiple times for a focus change.