Google chrome 在后台播放chrome扩展
我正在做一个chrome扩展提醒,我想在预约具体时间之前发出通知,我不想让用户一直打开extesnion的窗口,我从中了解了背景信息 我在manifest.json中添加了后台页面和后台权限,如下所示Google chrome 在后台播放chrome扩展,google-chrome,background,google-chrome-extension,Google Chrome,Background,Google Chrome Extension,我正在做一个chrome扩展提醒,我想在预约具体时间之前发出通知,我不想让用户一直打开extesnion的窗口,我从中了解了背景信息 我在manifest.json中添加了后台页面和后台权限,如下所示 { "name": "Alert extention", "version": "2.0", "description": "Personal alert.", "background_page": "Alert.html", "browser_actio
{
"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"
]
}
但在扩展关闭时不会发生通知。我在第一次通知出现时为扩展重新加载,但其他人没有
我通过将我想在后台工作的代码包装到这两行代码中来解决这个问题
chrome.extension.getViews().forEach(function(view){
//my code go here!
});