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

REQUEST USER PERMISSION TO DISPLAY DESKTOP NOTIFICATIONS

Before you can display a Desktop Notifications API pop-up window in Chrome, you must request permission from the user using an infobar. An infobar is a subtle slide-down prompt that appears underneath the URL bar and asks the user a question. The user must grant permission for your web app to use the API; otherwise, all other desktop notification calls will be ignored.

This ensures that the user actually wants the desktop notification feature active, avoiding the problems associated with rampant abuse of unwanted pop-up windows in the late 1990s and early 2000s.

Although you can call the checkPermission() method at any time, you can call requestPermission() only on a click event performed ...

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