Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/action/getpopup/index.md
6566 views
---
title: action.getPopup() slug: Mozilla/Add-ons/WebExtensions/API/action/getPopup page-type: webextension-api-function tags: - API - Add-ons - Extensions - Method - Non-standard - Reference - WebExtensions - action - getPopup browser-compat: webextensions.api.action.getPopup
---

{{AddonSidebar()}}

Gets the HTML document set as the popup for this browser action.

Note: This API is available in Manifest V3 or higher.

This is an asynchronous function that returns a Promise.

Syntax

let gettingPopup = browser.action.getPopup( details // object )

Parameters

  • details

    • : An object with the following properties:

      • tabId {{optional_inline}}

        • : integer. The tab whose popup to get.

      • windowId {{optional_inline}}

        • : integer. The windows whose popup to get.

  • If windowId and tabId are both supplied, the function fails.

  • If windowId and tabId are both omitted, the global popup is returned.

Return value

A Promise that will be fulfilled with a string containing the URL for the popup's document. This will be a fully qualified URL, such as moz-extension://d1d8a2eb-fe60-f646-af30-a866c5b39942/popups/popup2.html.

Examples

Get the popup's URL:

function gotPopup(popupURL) { console.log(popupURL); } let gettingPopup = browser.action.getPopup({}); gettingPopup.then(gotPopup);

{{WebExtExamples}}

Browser compatibility

{{Compat}}

Note: This API is based on Chromium's chrome.action API. This documentation is derived from browser_action.json in the Chromium code.