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 ...

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.