Global Constant
Steve Nay's ramblings

Using Chrome desktop notifications on your own site

Google Chrome has an API to allow websites to use desktop notifications. This is the same thing that Google’s apps (e.g., Gmail) and some Chrome extensions (e.g., TweetDeck) use for message notifications. It’s drop-dead simple to use. Here’s a simple example:

This does two things. First, it requests permission for the website to display notifications. This presents the user with this banner:

Once permission has been obtained, the callback displays the notification like this:

Of course, you will want to use the checkPermission() function to make sure the user clicked “Allow”. If they denied permission, you might have to do something else.

Here is some documentation from the Chromium project about Chrome’s implementation, and here is a more in-depth example.