Error with iconUrl for chrome.notifications
Error with iconUrl for chrome.notifications
所以我正在从我的页面内javascript创建通知切换到通过我的chrome扩展程序的后台脚本创建通知。当我在页面中创建通知时,我只需将图像 URL 传递给通知,一切就会正常。但是当我使用 chrome.notifications 执行此操作时,我收到错误。
var icon_url = request.image;
console.log(icon_url);
chrome.notifications.create(
{
type:"image",
iconUrl: icon_url,
title: request.name,
message: ("by "+request.artist+"'non "+request.album),
eventTime: Number(pref[0])*1000
},
function(notificationId) {
}
);
当它运行时,我收到以下控制台错误 - Unchecked runtime.lastError while running notifications.create: Image resource provided for notification type != image
我正在处理与此链接类似的图像资源。我怀疑可能是我需要在使用图像之前以某种方式加载图像(?这是我能想到的唯一问题,因为图像已经加载到潘多拉页面上。
它并没有真正回答我最初的问题,但是通过将通知的type
从"图像"更改为"基本",它按照我预期的工作方式工作-
var icon_url = request.image;
console.log(icon_url);
chrome.notifications.create(
{
type:"basic",
iconUrl: icon_url,
title: request.name,
message: ("by "+request.artist+"'non "+request.album),
eventTime: Number(pref[0])*1000
},
function(notificationId) {
}
);
相关文章:
- Chrome WebKitGetUserMedia
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- 在chrome.tabs.onCreated之后加载HTML页面
- chrome扩展中的navigator.geolocation.getCurrentPosition
- chrome扩展:尽管运行了at:documentidle,js脚本还是过早启动
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- chrome扩展更改主机/域警告
- Chrome开发工具(如何知道我在调用哪个javascript对象)
- 如何在chrome扩展中重定向到html页面
- Chrome扩展没有't在重新加载之前考虑期权价值
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- 激活chrome上的chrome.notifications对象
- 如何通过自己获得Chrome扩展的用户反馈/错误报告
- JS可以在Chrome中工作,但不能在Firefox中工作
- Chrome加载旧版本的Javascript文件
- Error with iconUrl for chrome.notifications
- chrome.notifications.update() or create()
- Webkit or W3C Notifications in Chrome for Android?
- Chrome.notifications.create()在点击时给出错误的id
- 打包应用中的 Chrome 通知“Chrome.notifications.create”