脚本:
chrome.notifications.create(
'name-for-notification',{
type: 'basic',
iconUrl: 'icon4.png',
title: "This is a notification",
message: "hello there!"
});Run Code Online (Sandbox Code Playgroud)
每次我运行它,我都会收到错误
运行notifications.create时未经检查的runtime.lastError:无法下载所有指定的图像.
但这就是事情,"icon4.png"与我的脚本,背景在同一个文件中. 你自己看.
我不知道为什么它不起作用,图标就在那里.我也试过用这个:
chrome.notifications.create(
'name-for-notification',{
type: 'basic',
iconUrl: 'http://www.filehosting.org/file/details/671921/icon4.png',
title: "This is a notification",
message: "hello there!"
});Run Code Online (Sandbox Code Playgroud)
它仍然无法正常工作!
是的,我在清单中设置了通知权限.
javascript google-chrome google-chrome-extension google-chrome-devtools