Skip to main content

Showing Notifications with HTML5/Webkit

Most of us use popular twitter clients such as TweetDeck, Seesmic which are developed using Adobe AIR. One thing  I like about these clients is that they show notifications when the application is in the minimized mode. Now with browsers implementing webkit such as Google chrome one can use the notification API to send notification to the browser. In this blog post I will be explaining how one can implement webkit notifications in their web application. 


Before we get started with creating notifications we need to check whether the Browser supports the Notification API. This is a simple:

if(window.webkitNotifications)
    //your browser supports Notifications
else
    //switch to other browser that support Notifications

The next step would be to get user permissions to show notifications from the website:
if (window.webkitNotifications.checkPermission() == 0) {
    //show notification code
}
else {
    //request for permission and then show notification code
    window.webkitNotifications.requestPermission();
}
The checkPermission method returns '0' if the website has granted permission to show notifications and returns '1' otherwise. The requestPermission method requests the user to provide permission to show notifications. Once the user has provided the permission the next step would be to show the notification to the user:
showMessageAsNotification = function() {
    window.webkitNotifications.createNotification('image','title','content').show();
}

The createNotification method used here displays the notification to the user on the bottom right corner of the screen. For example when the user clicks on a button he will shown a notification with a welcome message:



The notification shown contains a picture, title as 'Sagar' and the message 'Welcome'. It also provides information such as the website from which the notification is shown and an option to Dismiss the message. The options button allows user to disable notifications from the website.
Strictly speaking this is not a part of HTML5 specification rather it is a webkit feature. Therefore this may work only with browsers implementing webkit. 

Comments

  1. eh? is this really part of HTML5 or just something that works only on webkit-based browser??

    ReplyDelete
  2. Yes Henry, you are right. I have updated my blog.

    ReplyDelete
  3. I have read many of your post and this post is wonderful.... all of your post are just awesome. Get marketing assignment help in uk.

    ReplyDelete
  4. I am an academic writer at Sample Assignment. I have gone through this piece of writing; it is quite interesting and informative as well. Well, we all know that Sample Assignment is a brand in the field of education. Generally, it helps out the students in their academic in the form of providing assignment help, assignment samples, live sessions, expert consultation etc. If you want to check for sample assignment reviews visit our website. It was incorporated in the year 2009 and since then it has been continuously assisting students in completing their assignment. It works with professional's writers who have adequate knowledge about how to deal with assignments. Also, they have years of experience as assignment provider. All our writers have worked for more than thousands of assignment papers which have helped them in understanding the importance and requirement of the assignment. Get cheap assignment help Australia from us at best price.

    ReplyDelete

  5. This very blog is really interesting and besides diverting. I have chosen a lot of interesting stuff out of it. I ad love to visit it again and again. thank you for sharing such an interesting blog with us!

    Phone Cleaner for Android

    ReplyDelete
  6. Order now for Australian assignment help by assignment experts who are always ready to serve you with every kind of paper writing service. The writer assigned for academic help are subject-specific and have expertise in providing the work to the students come diverse of universities. Visit AllAssignmentHelp for round the clock academic services.

    ReplyDelete
  7. Download HD Bollywood, Hollywood, Tamil Movies on Khatrimaza. Get Instant 1080P movies with clear pixcels, 720P mp3movies on Khatrimaza.best

    ReplyDelete
  8. I am a freelancer and have been helping a lot of students in providing assistance to students who frequently gets worried about their assessment tasks and went online to search for assignment help service terms.
    We at My Assignment Services have potentially recognized the need way back and started what we are an enlarged version of then. With many assignment helper companies in the market, no one has quite able to match the standard that we follow. We give utmost priority to students by strictly adhering to the assignment requirements as well as marking rubrics to score high grades. Our programming assignment help writers are well-proficient in not only comprehending your assessment tasks but also to give an expert finish to it.
    Provided a well-written assignment suitable to your needs, your search for professional essay writers will now end with My Assignment Services. You just have to visit our website for more information.

    ReplyDelete
  9. According to experts, Java Homework Help can prove to be very helpful for developing communication skills. The most popular is the assignment provided by a team of experts.

    ReplyDelete
  10. When it comes to your career prospects and bright future, Assignment Help takes the onus on itself to promote your growth in the right direction. So, that way you wouldn’t have to think twice before trusting us with your academic papers. Place an order with us now and reap the rewards of brilliantly written academic papers today. My CDR Report Writer, one of the leading academic solution providers in Australia, understands the challenges and extends a helping hand to the aspiring engineers who are willing to land a job in Australia.
    Online Assignment Help Australia
    Assignment Help Sydney
    Assignment Help Melbourne
    My CDR Report Writer
    Dissertation Writing Services UK
    Programming Coding Help

    ReplyDelete
  11. Great Read! One of the best guest blog website Simply Cleaver

    ReplyDelete
  12. You just need to call them or sign in to their site. There you have to set up all the task subtleties and they will give you an elegantly composed and well-organized review. These administrations are pocket-accommodating as well as ecstasy for understudies attempting to finish their assignments on schedule.
    my assignment help
    Nursing assignment help

    ReplyDelete
  13. Dear Author, Thanks for sharing the useful and informative information. I am regularly reading your blog articles and its much impressive. I am also a blogger, writing reviews on different - different websites, apps, products and other more. If you want to read my reviews on websites and products, please check somme examples as: Bolly4u HD Movies Download
    Movies4u HD Movies Download
    9xmovies HD Movies Download
    Way2sms Free SMS
    Downloadhub HD Movies Download
    WorldFree4u HD Movies Download
    FilmyZilla HD Movies Download

    ReplyDelete
  14. I am a freelancer and have been helping a lot of students in providing assistance to students who frequently gets worried about their assessment tasks and went online to search for Australian Assignment Help terms.
    We at My Assignment Services have potentially recognized the need way back and started what we are an enlarged version of then. With many assignment helper companies in the market, no one has quite able to match the standard that we follow. We give utmost priority to students by strictly adhering to the assignment requirements as well as marking rubrics to score high grades. Our resume writing services writers are well-proficient in not only comprehending your assessment tasks but also to give an expert finish to it.
    Provided a well-written assignment suitable to your needs, your search for myob assignment help will now end with My Assignment Services. You just have to visit our website for more information.

    ReplyDelete
  15. This is a wonderful post. Thanks for sharing visit at Top seo agency 2019

    ReplyDelete
  16. dalam bermain poker online harus terpercaya dan bisa mendapatkan keuntungan yang besar seperti pokerseleb situs poker online uang asli banyak bonusnya
    https://medium.com/@pokerseleb/poker-online-uang-asli-banyak-bonusnya-938fe0500429

    ReplyDelete
  17. Hello,this is an awesome post thanks for sharing.It is relay enjoy to read this post.
    Essaysnassignments
    writing a personal statement

    ReplyDelete
  18. that spread among family members, you should contact a company specialized in the field of pest control in the best way with the use of the strongest insecticides safe for health and officially authorized The Ministry of Health, where the insect control company in Dammam to work on the highest efficiency and the fullestشركة مكافحة النمل الابيض بخميس مشيط
    شركة مكافحة حشرات بخميس مشيط
    شركة رش مبيدات بخميس مشيط
    ارخص شركة مكافحة حشرات

    ReplyDelete
  19. Thanks For Sharing your valuable content!!!!!

    Every man in this world has a thirst for lust. Agreed or not? Well, it can only be satisfied with extreme sexual pleasure. So sex dolls have become one of the hot topics in society today. There is no doubt that these erotic beauties have been a source of fulfilling even the wildest fantasies in no time. Since there are different types of love dolls available in the market, so it is vital for the buyer to choose the right and beautiful cheap sex doll. So for more information click in this link.

    ReplyDelete
  20. Thanks for your sharing! The information your share is very useful to me and many people are looking for them just like me!
    First grade NJ is helpful to get the basic knowledge for your kid so that they can more about it. Thus, preschool education NJ compulsory for every toddler. So are looking Preschool Near Edison? Then Igostem Academy one of the best starting school for your kids. Consult us today!

    toddler new jersey
    summer camp NJ
    PreSchool New Jersey
    summer camp
    preschool classes NJ

    ReplyDelete
  21. Get the outstanding sna level 5 assignments examples at an affordable price from Ireland assignment help. our expert assignment helpers are available 24*7 for help students. we offer various complimentary assignment help services to all students of Ireland.

    ReplyDelete
  22. pokerseleb Situs Poker Online Terpercaya dan IDN Poker Uang Asli yang menyadiakan berbagai fasilitas dan permainan poker yang bisa anda mainkan dengan modal 10 ribu saja anda juga berkempatan mendapatkan jackpot senilai 850 juta rupiah di pokerseleb.

    ReplyDelete
  23. when you want to check the live train status updates get here

    ReplyDelete
  24. Occurring problem in writing an assignment. Our experts writers and ready to give the solution for your problem. Our experts are ready to write your assignment perfectly. We have 10+ years of experience in writing. NZ Assignment Help are giving instant services for all the students.

    ReplyDelete
  25. Hire our expert for writing your human resources assignment. UAE Assignment Help have a huge team of 1000+ writers and we are giving top-quality highly researched content for all the assignment help. Our writers have 10+ years of experience and we are giving 100% privacy for your human resources assignment.

    ReplyDelete
  26. In case your HP printer driver setup does not work properly, then you must surf on 123.hp.com/setup. As pr your need and compatibility key attribute, you can get compatible 123.hp.com/setup for getting the suitable result. For knowing more information, you can surf our website.
    https://l-123hp.com/

    ReplyDelete
  27. assignment help online is the online administration where students can get full learning in any scholastic session. The points are performed by the prerequisite of students as it were.
    mathematics assignment help

    ReplyDelete
  28. We are a reliable third party technical support service provider, offering online technical support services for brother printer users. If you’re experiencing difficulties related to
    brother printer wifi setup, our printer technicians are very trained to solve this error simply.

    ReplyDelete
  29. When i read your blog i get some knowledge to read this post thanks for sharing this post.
    house cleaning
    move out cleaning

    ReplyDelete
  30. I suggest all members choose assignment help Australia for the best guideline in your academia. The perfect and expert assistant your requirement and learning assignment project by the university.

    ReplyDelete
  31. We offers www.allassignmenthelp.com to the students by the help of its expert assignment writers. If you need any college level Assignment Help at prime quality with better work. Kindly visit All Assignment Help.
    Masters Dissertation Help
    Master Thesis Help

    ReplyDelete
  32. Singapore Translation Services is one of the finest translation company in Singapore and abroad. If you are looking for business translation help then you must come with us. Singapore translators.com has a community of professional human translators in 100+ languages. We provide human only translation on our platform.

    ReplyDelete

Post a Comment

Popular posts from this blog

Custom validation messages for HTML5 Input elements using the constraint validation API

HTML5 has introduced several input types such as EMAIL, URL, RANGE, SEARCH, DATE, TIME, etc,. Most of the modern browsers have implemented them and are ready to be used in a HTML document. Another exciting feature introduced in HTML5 is the form validation. Instead of writing JavaScript to validate users input, browsers can now validate it and show an appropriate message if the validation fails. The validation message is shown in line with the field for which the validation has failed. The default error message is shown when the validation fails. In this post I'll explain how these error messages can be changed.

De-obfuscating javascript code in Chrome Developer Tools

I had blogged about JavaScript debugging with Chrome Developer Tools some time back, wherein I have explained how these developer tools can help in debugging javascript code. Today Google Chrome 12 was released and my Chrome browser was updated to this version. As with every release, there have been some improvements made on performance, usability etc,. One feature that stood out for me is the ability to De-obfuscate the javascript code.

What is Minification?

Minification is the process of removing unnecessary characters such as white spaces, comments, new lines from the source code. These otherwise would be added to make the code more readable. Minifying the source code helps in reducing the file size and thereby reducing the time taken to download the file. This is the reason why most of the popular javascript libraries such as jQuery are minified. A minified jQuery file is of 31 KB in size where as an uncompressed one is about 229 KB. Unfortunately, debugging minified javascript file…

Adding beforeRender and afterRender functions to a Backbone View

I was working on a Backbone application that updated the DOM when a response was received from the server. In a Backbone View, the initialize method would perform some operations and then call the render method to update the view. This worked fine, however there was scenario where in I wanted to perform some tasks before and after rendering the view. This can be considered as firing an event before and after the function had completed its execution. I found a very simple way to do this with Underscore's wrap method.