docs.rodeo

MDN Web Docs mirror

Differences between API implementations

{{AddonSidebar}} 

The browser extensions API is an emerging standard. As a result, while it is supported by most major browsers – including Firefox, Chrome, Edge, and Opera – there are differences between the various implementations. This means some changes may be necessary to implement your extension for multiple browsers.

Among the various browsers supporting the extensions API, Firefox is the most compliant with the emerging standard and, therefore, is your best place to start when developing browser extensions.

The differences between browsers’ API implementations fall into four areas: namespace, asynchronous event handling, API coverage, and manifest keys.

Namespace

You reference all extensions API functions using a namespace. For example, browser.alarms.create({delayInMinutes}); creates an alarm in Firefox that goes off after the time specified in delayInMinutes.

There are two API namespaces in use:

Asynchronous event handling

JavaScript provides several ways to handle asynchronous events. The proposed extensions API standard is to use promises. The promises approach offers significant advantages when dealing with chained asynchronous event calls.

Firefox and Safari implement promises for the extensions API. All other browsers use callbacks. In Manifest V3, Chrome, Edge, and Opera provided for promises on most appropriate methods. (cf. Chrome bug 328932)

If you are unfamiliar with how JavaScript can handle asynchronous events or promises, look at Getting to know asynchronous JavaScript: Callbacks, Promises and Async/Await or the MDN Using promises page.

API coverage

The differences in the extensions API function implementations among the browsers fall into three broad categories:

Manifest keys

The differences in the supported manifest.json keys among the browsers fall broadly into two categories:

More information

You can find more detailed information about the differences in the supported browser extensions API features in:

In this article

View on MDN