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 
); 
+0

我很肯定你需要在'webkitNotificacions'之前聲明'window'或'chrome'。 – Braiam

回答

2

notifications權限不會傳播到內容腳本。

event page添加到您的分機和send a message以打開來自活動頁面的通知。