在背景中播放镀铬扩展

时间:2011-11-12 20:53:24

标签: google-chrome background google-chrome-extension

我正在制作一个警报镀铬扩展程序,我想在约会之前通知特定时间,我不希望用户一直打开extesnion窗口,我从here读到了背景信息。

我在manifest.json中添加了background_page和background权限,就像这个

一样
 {
    "name": "Alert extention",
    "version": "2.0",
    "description": "Personal alert.",
    "background_page": "Alert.html",
    "browser_action": {
        "default_icon": "img/clock.png",
    "popup": "Alert.html"
    },
    "permissions": [
        "notifications","background"
    ]
}

但扩展程序关闭时不会发出通知。我在第一次通知发生时重新加载扩展名,但其他通知没有。

What should make ??? any suggestion??

1 个答案:

答案 0 :(得分:0)

我通过将我想在后台工作的代码包装到这两行代码中来解决问题。

chrome.extension.getViews().forEach(function(view){
      //my code go here!
});
相关问题