没有通知权限

时间:2013-07-24 01:02:19

标签: google-chrome google-chrome-extension google-chrome-app

问题是,在运行此扩展程序时,我会在尝试发出通知时收到SecurityError DOM 18

这就是我的清单文件的样子:

{
 "name": "No",
 "manifest_version": 2,
 "version": "1",
 "content_scripts": [
  {
   "js": ["js.js"]
  }
 ], 
 "permissions": [
 "notifications", "tabs"
 ],
 "web_accessible_resources": [
 "48.png"
 ]
}

这是通知:

var notification = webkitNotifications.createNotification(
    '/favicon.ico',
    'Item added to cart!',  // notification title
    'Item ............ has been successfully added to the cart.'  //       notification body text
);

1 个答案:

答案 0 :(得分:2)

notifications权限不会传播到内容脚本。

在您的扩展程序中添加event page,并在send a message添加活动页面中的通知。