小编esp*_*sp0的帖子

"无法下载所有指定的图像." 尝试在Chrome扩展程序上运行通知时

脚本:

 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

1
推荐指数
1
解决办法
800
查看次数