Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/pageaction/setpopup/index.md
6567 views
------{{AddonSidebar()}}
Sets the HTML document to be opened as a popup when the user clicks on the page action's icon.
Syntax
Parameters
details:
object.tabId:
integer. The ID of the tab for which you want to set the popup.
popup:
stringornull. URL to the HTML file to show in a popup.If an empty string (
"") is passed here, the popup is disabled, and the extension will receive {{WebExtAPIRef("pageAction.onClicked")}} events.If
nullis passed here, the popup is reset to the popup that was specified in thepage_actionmanifest key.
Browser compatibility
{{Compat}}
Examples
Listen for {{WebExtAPIRef("tabs.onUpdated")}} events, and switch the popup if the loading status changes:
{{WebExtExamples}}
Note: This API is based on Chromium's
chrome.pageActionAPI. This documentation is derived frompage_action.jsonin the Chromium code.