Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Chrome扩展插件';s的内容脚本未被注入任何网页_Javascript_Jquery_Google Chrome_Google Chrome Extension - Fatal编程技术网

Javascript Chrome扩展插件';s的内容脚本未被注入任何网页

Javascript Chrome扩展插件';s的内容脚本未被注入任何网页,javascript,jquery,google-chrome,google-chrome-extension,Javascript,Jquery,Google Chrome,Google Chrome Extension,我正在做一个简单的chrome扩展,我试图在这些特定的网页中包含一个内容脚本。但问题是他们没有被纳入网站。我使用Chrome的开发者工具进行了检查。 然后我将match_URL设置为所有页面,但它们仍然没有被包括在内 下面是manifest.json: { "manifest_version": 2, "name": "TestExten", "description": "Test description.", "version": "1.0", "browser_act

我正在做一个简单的chrome扩展,我试图在这些特定的网页中包含一个内容脚本。但问题是他们没有被纳入网站。我使用Chrome的开发者工具进行了检查。 然后我将match_URL设置为所有页面,但它们仍然没有被包括在内

下面是manifest.json

{
  "manifest_version": 2,

  "name": "TestExten",
  "description": "Test description.",
  "version": "1.0",
  "browser_action": {
   "default_icon": "icon.png",
   "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "run_at": "document.end",
      "js": ["content.js"]
    }
  ],
  "permissions": [
    "tabs",
    "http://*/", "https://*/",
    "cookies"
  ],
}
alert("loaded");
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
     alert("received message");
});
以及content.js

{
  "manifest_version": 2,

  "name": "TestExten",
  "description": "Test description.",
  "version": "1.0",
  "browser_action": {
   "default_icon": "icon.png",
   "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "run_at": "document.end",
      "js": ["content.js"]
    }
  ],
  "permissions": [
    "tabs",
    "http://*/", "https://*/",
    "cookies"
  ],
}
alert("loaded");
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
     alert("received message");
});
这里出了什么问题?

看看这里:

参数
run\u at
接受
document\u end
,而不是
document.end
。因此,您的清单应该如下所示:

{
  "manifest_version": 2,

  "name": "TestExten",
  "description": "Test description.",
  "version": "1.0",
  "browser_action": {
   "default_icon": "icon.png",
   "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "run_at": "document_end",
      "js": ["content.js"]
    }
  ],
  "permissions": [
    "tabs",
    "http://*/", "https://*/",
    "cookies"
  ],
}

是否确实已安装并启用扩展?它是
document\u end
(而不是
document.end