【问题标题】:Nothing happens when I click my chrome extension当我单击我的 chrome 扩展程序时没有任何反应
【发布时间】:2015-07-05 08:38:52
【问题描述】:

我遇到了一个问题,当我点击我的 chrome 扩展程序时,什么都没有发生。我希望会有一个警告框。

这是我的 manifest.json:

{
   "background": {
   "scripts": ["background.js"]
   },
   "browser_action": {
      "default_icon": "icon-gif.png",
      "default_title": "AlertBoxer"
   },
   "description": "Use this extension to see an alert box",
   "icons": {
      "128": "icon-gif.png",
      "19": "icon-gif.png",
      "48": "icon-gif.png"
   },
   "name": "C3P0",
   "permissions": ["notifications"],
   "version": "1.0",
   "manifest_version": 2
}

还有 background.js 文件:

chrome.browserAction.onClicked.addListener(function (tab) {
        alert("Hi");  
});

【问题讨论】:

    标签: javascript jquery google-chrome google-chrome-extension google-chrome-devtools


    【解决方案1】:

    解决方法是更改​​:

    "background": {
        "page": "background.js"
        },
    

    到:

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

    更新了原始帖子以显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多