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

js
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.

Examples

Check the topmost window:

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

Check all open windows:

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

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
isOpen
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
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
No support
No support