MDN / browserAction.openPopup()
MDN / browserAction.openPopup()
Open the browser action’s popup.
Syntax
browser.browserAction.openPopup(
options // optional object
)
Parameters
details: An object with these properties:
windowId:
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 withfocused: 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:
browser.menus.create({
id: "open-popup",
title: "open popup",
contexts: ["all"],
});
browser.menus.onClicked.addListener(() => {
browser.browserAction.openPopup();
});