이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 참여해서 번역을 마치도록 도와 주세요!
English (US)의 문서도 읽어보세요.

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

Syntax

browser.pageAction.setPopup(
  details // object
)

Parameters

details
object.
tabId
integer. The ID of the tab for which you want to set the popup.
popup
string or null. 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 pageAction.onClicked events.
If null is passed here, the popup is reset to the popup that was specified in the page_action manifest key.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
setPopupChrome Full support YesEdge Full support 14Firefox Full support 45Opera Full support YesFirefox Android Full support 50
Notes
Full support 50
Notes
Notes The 'tabId' parameter is ignored, and the popup is set for all tabs.
The popup property of the details parameter can be set to null.Chrome No support NoEdge No support NoFirefox Full support 59Opera No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.

Examples

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

browser.tabs.onUpdated.addListener((tabId, changeInfo, tabInfo) => {
  if (changeInfo.status) {
    browser.pageAction.show(tabId);
    if (changeInfo.status == "loading") {
      browser.pageAction.setPopup({
        tabId,
        popup: "/popup/loading.html"
      });
    } else {
      browser.pageAction.setPopup({
        tabId,
        popup: "/popup/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.

문서 태그 및 공헌자

이 페이지의 공헌자: mdnwebdocs-bot, wbamberg, Loirooriol, Makyen, chrisdavidmills
최종 변경자: mdnwebdocs-bot,