Google扩展程序弹出窗口未显示

时间:2016-02-26 16:59:58

标签: javascript google-chrome-extension manifest

{
"browser_action": {
    "default_title": "Bot 2.0",
    "default_icon": "logo.png",
    "default_popup": "view/options.html"

我一直试图激活弹出功能,但每次点击它都没有任何反应。我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

问题出在manifest.json文件中,你写了2次browser_action属性:

{
    "browser_action": {
        "default_title": "Bot 2.0",
        "default_icon": { "38": "icon38by38pixels.png" },
        "default_popup": "popup.html"
    },
   .....
   "browser_action": {
      "default_icon": "logo.png"
   },
   .....
}

您需要在browser_action

中只编写一次manifest.json
{
    "browser_action": {
        "default_title": "Bot 2.0",
        "default_icon": "logo.png",
        "default_popup": "popup.html"
    },
   "background": {
      "persistent": false,
      "scripts": [ "view/jquery-1.9.1.min.js", "background.js" ]
   },
   "content_scripts": [ {
      "js": [ "view/jquery-1.9.1.min.js", "supreme.js" ],
      "matches": [ "*://*.supremenewyork.com/*" ],
      "run_at": "document_start"
   }, {
      "js": [ "view/jquery-1.9.1.min.js", "checkout.js" ],
      "matches": [ "*://*.supremenewyork.com/checkout/*" ],
      "run_at": "document_end"
   } ],
   "description": "X",
   "icons": {
      "128": "logo.png",
      "16": "logo.png",
      "48": "logo.png"
   },
   "manifest_version": 2,
   "name": "Bot 2.0",
   "options_page": "view/options.html",
   "permissions": [ "tabs", "*://*.supremenewyork.com/*" ],
   "version": "1.0",
   "web_accessible_resources": [ "view/jquery.min.map" ]
}