O'Reilly logo

HTML5: Your visual blueprint™ for designing rich web pages and applications by Adam McDaniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

LISTEN FOR DESKTOP NOTIFICATION EVENTS

You can define custom JavaScript callback functions at specific events to be executed as the Desktop Notifications API interacts with the user. There are four events in the Notification interface for which you can listen:

notifyMessage.ondisplay = function() { ... };
notifyMessage.onclick = function() { ... };
notifyMessage.onclose = function() { ... };
notifyMessage.onerror = function() { ... };

The ondisplay event is called whenever the notification message is actually displayed on the desktop after calling show() . This will allow you to know if a delay occurred caused by too many messages on-screen.

The onclick event is called whenever the user clicks the message itself. It is a good idea to call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required