Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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.

Syntax

chrome.management.setEnabled(
  id,              // string
  enabled,         // boolean
  function() {...} // function
)

This API is also available as browser.management.setEnabled() in a version that returns a promise.

Parameters

id
string. ID of the add-on to enable/disable.
enabled
boolean. Whether to enable or disable the add-on.
callbackOptional
function. Called when the add-on has been enabled or disable. The function is passed no arguments.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No No No Yes

Examples

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

var id = "my-add-on";

function toggleEnabled(id) {
  chrome.management.get(id, (info) => {
    chrome.management.setEnabled(id, !info.enabled);
  });
}

toggleEnabled(id);

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,