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

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
openPopup
Chrome – No support
Chrome 67 (Release date: 2018-05-29)
disabled
disabled From version 67 users must explicitly set the #extension-apis preference to Enabled. To change preferences in Chrome, visit chrome://flags.
Edge – No support
Edge 79 (Release date: 2020-01-15)
disabled
disabled From version 79 users must explicitly set the #extension-apis preference to Enabled. To change preferences in Edge, visit about:flags.
Firefox – Full support
Firefox 57 (Release date: 2017-11-14)
footnote
footnote Before Firefox 149, a user gesture is required to call this API.
footnote Support for the windowId parameter was added in Firefox 108.
Opera – No support
Opera 54 (Release date: 2018-06-28)
disabled
disabled From version 54 users must explicitly set the #extension-apis preference to Enabled. To change preferences in Opera, visit opera://flags.
Safari – Full support
Safari 16 (Release date: 2022-09-12)
footnote Full support
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16 (Release date: 2022-09-12)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.
User must explicitly enable this feature.