Saturday, 15 October 2011

HTML5 Notifications

You can now send simple or HTML notifications to the users of your website from JavaScript. 

Here’s what the simple notification looks like with an icon included:

image

Here's the syntax, note you have to check the user has granted permission:

The image below shows a user receiving both a simple plain text (without an icon) and an HTML notification “pop up”:

image 

HTML Code

JavaScript Code

You can run the sample here:  http://stevenhollidge.com/html5demos/notifications

Or view all the HTML5Rocks demos here:  http://playground.html5rocks.com

No comments:

Post a Comment