Reputation: 495
So i'm switching from creating notifications from my in-page javascript to creating the notifications through the background script of my chrome extension. When I was creating the notifications in-page, I could just pass the image URL to the notification and everything would work fine. But i'm getting an error when I do this using 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) {
}
);
And when that runs, I get the following console error- Unchecked runtime.lastError while running notifications.create: Image resource provided for notification type != image
I'm dealing with image resources similar to this link. I suspect that it might be that I need to somehow load the image before using it (?). Thats the only problem I could think of because the image is already loaded on the Pandora page.
Upvotes: 1
Views: 1380
Reputation: 495
It doesnt really answer my original question, but by changing the type
of the notification from "image" to "basic" it worked as I expected it to work-
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) {
}
);
Upvotes: 2