1

I am creating a chrome native extension. I am used chrome.tabs.sendMessage (tabs[0].id, {parameters}, function(response) {});functionality to send messages from background.js to content script js page.The send messages are received on the content script by using chrome.extension.onMessage.addListener(function(msg, sender, sendResponse) { //code goes here }); method. The messages passing is not working with the pages like chrome://settings, chrome://extension, chrome://history etc. But the messages are working fine with other pages like google.com or any other webpages.

Here is a part of my manifest.json file

  {
"manifest_version": 2,

   "permissions": [
    "storage",
    "background",
    "alarms",
    "tabs",
    "activeTab",
    "http://*/*",
    "https://*/*"
],
"background": {
    "scripts": ["background.js","popup.js"],
    "persistent": true
},
 "content_scripts": [
{
  "matches": ["<all_urls>","http://*/*", "https://*/*", "file:///*"],
  "js": ["lib/jquery.js", "jquery.range2dslider.js", "popup.js"],
  "css":["jquery.range2dslider.css", "popup.css"]
}

}

Any help would be appreciated.

vivek k
  • 31
  • 6

1 Answers1

1

chrome:// is not a supported scheme for permission/content script matches. "<all_urls>" does not literally mean any URL, but any supported URL.

This is for security reasons: Chrome does not want intrusion on its internal pages.

You cannot inject a content script in such contexts, and as such there's nobody to listen.

Xan
  • 74,770
  • 16
  • 179
  • 206