W3cubDocs

/Web Extensions

sidebarAction.isOpen()

Returns true if the extension's sidebar is open in a given window.

This function accepts a windowId as a parameter:

  • If you supply windowId, the function will check the given browser window.
  • If you omit windowId, the function will check the topmost browser window.

This is an asynchronous function that returns a Promise.

Syntax

let gettingIsOpen = browser.sidebarAction.isOpen(
  details // object
)

Parameters

details
object. An object optionally containing the windowId to check.
windowId Optional
integer. ID of a browser window to check. If omitted defaults to windows.WINDOW_ID_CURRENT, which refers to the topmost browser window.

Return value

A Promise that will be fulfilled with true if the extension's sidebar is open in the given window, or false otherwise.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
isOpen
No
No
59
?
No
No
?
?
No
?
?
?

Examples

Check the topmost window:

browser.sidebarAction.isOpen({}).then(result => {
  console.log(result);
});

Check all open windows:

async function checkWindow(windowId) {
  let result = await browser.sidebarAction.isOpen({windowId});
  console.log(`window: ${windowId} status: ${result}`);
}

browser.windows.getAll().then(all => {
  for (let {id} of all) {
    checkWindow(id);
  }
});

© 2005–2021 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/sidebarAction/isOpen