0

问题是,当运行此扩展程序时,我会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
);
4

1 回答 1

2

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

事件页面添加到您的扩展程序,并发送消息以从事件页面打开通知。

于 2013-07-24T09:01:46.663 回答