management.setEnabled()

Enables or disables the given add-on.

This function must usually be called in the context of a user action, such as the click handler for a button. The browser may also ask the user to confirm the change.

This API requires the "management" API permission.

It is an asynchronous function that returns a Promise.

The function allows enabling/disabling of theme addons, but will return an error if used to enable or disable other types of web extension.

Syntax

js
let settingEnabled = browser.management.setEnabled(
  id,              // string
  enabled         // boolean
)

Parameters

id

string. ID of the add-on to enable/disable.

enabled

boolean. Whether to enable or disable the add-on.

Return value

A Promise that will be fulfilled with no arguments when the add-on has been disabled or enabled.

Examples

Toggle enable/disable for the add-on whose ID is "my-add-on":

js
let id = "my-add-on";

function toggleEnabled(id) {
  let getting = browser.management.get(id);
  getting.then((info) => {
    browser.management.setEnabled(id, !info.enabled);
  });
}

toggleEnabled(id);

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
setEnabled
Chrome – Full support
Chrome 8 (Release date: 2010-12-02)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Partial support
Firefox 55 – 139 (Release date: 2017-08-08)
footnote Partial support
footnote Extensions can only enable and disable themes.
Firefox – Partial support
Firefox 140 (Release date: 2025-06-24)
footnote Partial support
footnote Any extension can enable and disable themes.
footnote Extensions installed via policies can enable and disable any extension.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Partial support
Firefox for Android 55 – 139 (Release date: 2017-08-08)
footnote Partial support
footnote Extensions can only enable and disable themes.
Firefox for Android – Partial support
Firefox for Android 140 (Release date: 2025-06-24)
footnote Partial support
footnote Any extension can enable and disable themes.
footnote Extensions installed via policies can enable and disable any extension.
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Has more compatibility info.

Note: This API is based on Chromium's chrome.management API. This documentation is derived from management.json in the Chromium code.