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.
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.
let gettingIsEnabled = browser.action.isEnabled(
details // object
)
details
object. An object optionally containing the tabId or windowId to check.
tabId Optional
integer. ID of a tab to check.
windowId Optional
integer. ID of a window to check.
A Promise that will be fulfilled with true if the extension's browser action is enabled, and false otherwise.
Check the global state:
browser.action.isEnabled({}).then((result) => {
console.log(result);
});
Check the state of the currently active tab:
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);
}
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
isEnabled |
No | No | 109 | ? | No | No | ? | ? | 109 | ? | No | ? |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/action/isEnabled