Icon in desktop notification

194 views
Skip to first unread message

Zoltan Lippai

unread,
Feb 24, 2013, 3:58:07 AM2/24/13
to chromiu...@chromium.org
Hi there,

I was trying to set up desktop notifications for my website, but I'm stuck on setting the icon for the notification.
I've tried using Chrome stable (M25) and also Canary (M27) but both of them display the chrome or canary icon in the notification.
I'm starting to think that it may not be possible to do it on OSX.

Here is a code sample:

window.webkitNotifications.createNotification('https://webrtc.dev/images/notification/newMessage.png', 'Test', 'This is a test notification').show();

The png file is of course existing. I have also tried using relative URLs (e.g. /images/notification/newMessage.png) but it's the same result.

So is this because of OSX (I am using Mountain Lion with the Notification center) or am I doing something wrong?

Also, another quick question:
Is it possible to hide/replace the text that displays the domain of the site (shown in the attached picture, webrtc.dev).

Thanks a lot!
notification.png

Zoltan Lippai

unread,
Feb 24, 2013, 4:31:30 AM2/24/13
to chromiu...@chromium.org
Just a quick note: I have tried to set a favicon so maybe it would get displayed, but unfortunately that didn't work either.

Achin Sharma

unread,
Feb 24, 2013, 4:38:14 PM2/24/13
to chromiu...@chromium.org
Is it for a chrome app? The page linked below mentions a bug that requires the mention of image icon in web_accessable_resources in manifest. Maybe that's your problem?

Zoltan Lippai

unread,
Feb 24, 2013, 4:40:48 PM2/24/13
to chromiu...@chromium.org
No, it's not a Google Chrome app, it is a "website" created with ExtJS. It's more like a web application, but from Chromes point of view it is a simple website.

Achin Sharma

unread,
Feb 24, 2013, 4:45:42 PM2/24/13
to chromiu...@chromium.org
In that case I would suggest you look into html notifications. That way you can design your notification however you want. Even make them interactive. And as for hiding domain from notification, I am afraid it's not possible, for the same reasons as hiding url from the url bar is not possible. To let user know who made the notification.

Zoltan Lippai

unread,
Feb 24, 2013, 4:48:50 PM2/24/13
to chromiu...@chromium.org
Well, unfortunately here it says that createHTMLNotification is gone.

Drew Wilson

unread,
Feb 25, 2013, 3:59:45 AM2/25/13
to Zoltan Lippai, Chromium HTML5
From your screenshot, it looks like you're using a Mac.

Chrome routes all notifications on the Mac through the native notification center. This has a few side effects:

1) Notifications are automatically hidden after several seconds
2) Notifications cannot set the icon (all notifications generated by Chrome are automatically given a Chrome icon by the Mac notification center).

It is not possible to hide the text that displays the domain of the site, because otherwise people could use notifications for phishing (for example, I could display a notification that says something like "You have a new friend request" that when you click on it actually takes you to evil.com with a fake facebook signin page).

Unfortunately, on the Mac, the notification center doesn't have a particularly good way to display this type of domain information so it's just stuck in the middle of the notification. On other platforms, we have more control over how notifications are displayed, so it looks a little less clunky (we display the domain on a thin header bar).

-atw


--
You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-html...@chromium.org.
To post to this group, send email to chromiu...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.
For more options, visit https://groups.google.com/a/chromium.org/groups/opt_out.
 
 

Zoltan Lippai

unread,
Feb 25, 2013, 4:03:46 AM2/25/13
to chromiu...@chromium.org
Then it looks like my suspicion about OSX being the cause was right.
Thanks for the info, Drew!
Reply all
Reply to author
Forward
0 new messages