我的 chrome 扩展后台脚本没有被加载。我为他们遵循了谷歌的指南,但仍然没有。我不确定是否有另一种检查方法,但它不在 Inspect Element 中,并且脚本应该执行的操作没有发生。
http://developer.chrome.com/extensions/background_pages.html
manifest.json 文件
{
"manifest_version": 2,
"name": "WebDevFriend",
"description": "blah blah blah",
"version": "1.0",
"permissions": [
    "bookmarks",
    "tabs",
    "http://*/*"    ],  
"background": {
    "scripts": ["js/settings.js"],
},
"browser_action": {
    "default_icon": "images/icon.png",
    "default_popup": "html/popup.html"
}
}
settings.js 文件
chrome.windows.onCreated.addListener(function(window){
  chrome.windows.getAll(function(windows){
      var length = windows.length;
      if (length == 2) {
          chrome.tabs.executeScript(null, {file: "content_script.js"});
      }
  });
});
document.write('hello');
    