Search code examples
google-chromegoogle-chrome-extension

Make background-page visible in Google Chrome extension


I have a background-page in my Google Chrome extension, and this page is naturally invisible. Is there anyway to make this hidden page visible, say in a popup when a browser action icon is clicked? Then hide it again with another click.


Solution

  • The background page can be shown using the chrome.tabs.create method, which requires the tabs permission. For example, if your background page is called background.html, the following code can be used:

    chrome.tabs.create({url: chrome.extension.getURL('background.html')});
    

    See also: