Skip to content Skip to sidebar Skip to footer

Chrome Extension With Background Page Not Working With Manifest Version 2

I have a simple chrome extension which displays a little icon in Google Chrome. On click, it loads a search page of my site, which in term redirects you to the right page. https://

Solution 1:

You just need to remove the script tag from your background page. Here's how background.js(instead of background.html) should look like:

chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.getSelected(null,function(tab) {
        chrome.tabs.create( { url: "http://w3patrol.com/search.php?q=" +tab.url } );
    });
});

And remove the 'page' property in background. Add 'scripts' property:

  "background": {
    "scripts": ["background.js"]
  },

Post a Comment for "Chrome Extension With Background Page Not Working With Manifest Version 2"