pageAction.getPopup()
Gets the URL for the HTML document set as the popup for this page action.
This is an asynchronous function that returns a Promise
.
Syntax
var gettingPopup = browser.pageAction.getPopup(
details // object
)
Parameters
Return value
A Promise
that will be fulfilled with a string containing the popup's URL.
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
getPopup | ChromeFull supportYes | EdgeFull support14 | FirefoxFull support45 | OperaFull supportYes | SafariFull support14 | Firefox for AndroidFull support50
|
Legend
- Full support
- Full support
- See implementation notes.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Examples
Add a context menu item that logs the popup URL for the current tab. Note that you'll need the contextMenus
permission in your manifest to create context menu items.
function gotPopup(popupURL) {
console.log(popupURL);
}
browser.contextMenus.create({
id: "get-popup",
title: "Get popup URL"
});
browser.contextMenus.onClicked.addListener(function(info, tab) {
if (info.menuItemId == "get-popup") {
var gettingPopup = browser.pageAction.getPopup({tabId: tab.id});
gettingPopup.then(gotPopup);
}
});
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.