CUSTOMIZE THE DESKTOP NOTIFICATION UI

If the basic notification window structure is too plain for you, you can customize it by launching an HTML notification window with a custom URL. Simply save your notification message into a separate web page, and it will be displayed as the notification window content.

You use the same check permissions and display procedures to create your custom desktop notification UI as described earlier in this chapter, except that you replace createNotification() with createHTMLNotification() and specify the URL as the only argument:

var notifyAPI = window.webkitNotifications;
 if ( typeof notifyAPI == 'object' &&
      notifyAPI.checkPermission() == 0 ) {
   var notifyMessage = notifyAPI.
 createHTMLNotification(URL);
  notifyMessage ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.