Skip to content Skip to sidebar Skip to footer

Chrome Extension Page Action Not Showing Next To Omnibar

Manifest: { 'manifest_version':2, 'name':'Optimize url', 'description':'Optimize url', 'page_action':{ 'default_icon':{ '19':'url-icon16.png

Solution 1:

There are the following problems with your code:

  1. The variable tab, which is used in checkURL, is nowhere defined.

  2. The function parseURL is also nowhere defined (it is not a built-in function as you seem to assume).

It is, also, a good idea to filter the onUpdated events looking for status: 'complete', because several onUpdated events are triggered during a single tab update.

So, replace your background.js code with the following:

var hostRegex = /^[^:]+:\/\/[^\/]*url.com/i;
function checkURL(tabId, info, tab) {
    if (info.status === "complete") {
        if (hostRegex.test(tab.url)) {
            chrome.pageAction.show(tabId);
        }
    }
}
chrome.tabs.onUpdated.addListener(checkURL);

Post a Comment for "Chrome Extension Page Action Not Showing Next To Omnibar"