browserAction.getPopup()
Gets the HTML document set as the popup for this browser action.
This is an asynchronous function that returns aPromise.
In this article
Syntax
js
let gettingPopup = browser.browserAction.getPopup( details // object)Parameters
detailsAn object with the following properties:
tabIdOptionalinteger. The tab whose popup to get.windowIdOptionalinteger. The windows whose popup to get.
- If
windowIdandtabIdare both supplied, the function fails. - If
windowIdandtabIdare both omitted, the global popup is returned.
Return value
APromise that will be fulfilled with a string containing the URL for the popup's document. This will be a fully qualified URL, such asmoz-extension://d1d8a2eb-fe60-f646-af30-a866c5b39942/popups/popup2.html.
Examples
Get the popup's URL:
js
function gotPopup(popupURL) { console.log(popupURL);}let gettingPopup = browser.browserAction.getPopup({});gettingPopup.then(gotPopup);Browser compatibility
Note:This API is based on Chromium'schrome.browserAction API. This documentation is derived frombrowser_action.json in the Chromium code.