Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

pageAction.setPopup()

Sets the HTML document to be opened as a popup when the user clicks on the page action's icon.

Syntax

chrome.pageAction.setPopup(
  details // object
)

This API is also available as browser.pageAction.setPopup() in a version that returns a promise.

Parameters

details
object.
tabId
integer. The ID of the tab for which you want to set the popup.
popup
string. URL to the HTML file to show in a popup. If set to an empty string (''), no popup is shown.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 45.0 50.0 33

Compatibility notes

Firefox for Android

  • The 'tabId' parameter is ignored, and the popup is set for all tabs.

Examples

Listen for tabs.onUpdated events, and switch the popup if the loading status changes:

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tabInfo) => {
  if (changeInfo.status) {
    chrome.pageAction.show(tabId);
    if (changeInfo.status == "loading") {
      chrome.pageAction.setPopup({
        tabId,
        popup: "/popups/loading.html"
      });
    } else {
      chrome.pageAction.setPopup({
        tabId,
        popup: "/popups/complete.html"
      });
    }
  }
});

Acknowledgements

This API is based on Chromium's chrome.pageAction API. This documentation is derived from page_action.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, chrisdavidmills, wbamberg
 Last updated by: Makyen,