browserAction.openPopup()

Open the browser action's popup.

Syntax

js
browser.browserAction.openPopup(
  options // optional object
)

Parameters

details Optional

An object with these properties:

windowId Optional

integer. Window to open the popup in. Defaults to the focused (active) window. In Chrome and from Firefox 149, if the window ID is for an unfocused window, the API call is rejected. A window can be focused by calling windows.update with focused: true.

Return value

A Promise that resolves with no arguments. If the popup isn't opened, rejects with an error message.

Examples

Open the popup when the user selects a context menu item:

js
browser.menus.create({
  id: "open-popup",
  title: "open popup",
  contexts: ["all"],
});

browser.menus.onClicked.addListener(() => {
  browser.browserAction.openPopup();
});

Browser compatibility