HTML 5 has already placed the steps into web developement. As usual with any new version we are expecting a new features. So here is the same case with HTML 5 as well. HTML 5 has come with lots of new APIs to work with to improve the user interaction with just HTML. Isn’t it interesting? HTML 5 can be worked well with CSS3.
So here I am starting the series of articles related to API introduces in HTML 5. There are several API like Geolocation, Notification, File, etc. Here is the first article is related Notification API.
First thing you need to keep in mind, HTML 5 features and API will work on supported browsers only. So if browser is not supporting the HTML 5 then you can’t do any thing except html5 sims if possible. Today I am exploring the notification API.
Please note that this article is written for the browsers with webkit engine like Google Chrome (Not Mozila Firefox).
HTML 5 Notification is kind of notification which we can provide to user on certain events or even user is on another tab of the browser. This notifications can be useful for events like New Mail, New Tweet, etc.
There are several steps to work with Notification API. First we need to take permission from the user to show notification or not. We can show notification only if user has given the permission for the same.
We can show notification only if user has given the permission for the same.
So for first time this code will ask for permission instead of showing the notification. Now if user has given the permission to show the notification then we can show two types of notifications.
So now let’s jump into the code.
Have a look at this live demo for the same Notification API of HTML5. You should be asked for permission for showing the notification. If you allow then and then only above script will able to show the notifications.
For first time it will ask for permission rather than showing the notification.
So this is what I have explined for HTML 5 notification is applicable for Web Kit browsers only like Google Chrome. Mozilla Firefox has its own specification for this HTML 5 notification which I will cover in separate article.
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash