action.isEnabled()
Returns true if the browser action is enabled.
Note: This API is available in Manifest V3 or higher.
This is an asynchronous function that returns a Promise.
Syntax
js
let gettingIsEnabled = browser.action.isEnabled(
  details // object
)
Parameters
- details
- 
    object. An object optionally containing thetabIdorwindowIdto check.- tabIdOptional
- 
        integer. ID of a tab to check.
- windowIdOptional
- 
        integer. ID of a window to check.
 
- If windowId and tabId are both supplied, the function fails.
- If windowId and tabId are both omitted, the global enabled/disabled status is returned.
Return value
A Promise that will be fulfilled with true if the extension's browser action is enabled, and false otherwise.
Examples
Check the global state:
js
browser.action.isEnabled({}).then((result) => {
  console.log(result);
});
Check the state of the currently active tab:
js
async function enabledInActiveTab() {
  let tabs = await browser.tabs.query({
    currentWindow: true,
    active: true,
  });
  let enabled = await browser.action.isEnabled({
    tabId: tabs[0].id,
  });
  console.log(enabled);
}
Browser compatibility
BCD tables only load in the browser