Desktop Notification with Html5


I’ve recently stumbled upon studio.html5rocks.com and found the cool trick to display desktop notifications like Gmail.

![](/assets/Screen shot 2011-05-31 at 7.02.36 PM.png)

I thought it is cool, thinking of including it in any of my app I plan to do.

Here is the core part of the snippet.

var notification = window.webkitNotifications.createNotification("http://www.google.com/images/logos/ps_logo2.png", "Title", "Notification message goes here");

notification.show();

But you have to ask for user permission before displaying the notification. Find the complete tutorial at html5rocks.com


Post Comment