As explained in What Makes a Good Notification, good notifications are timely, relevant, and precise. If your page asks for permission to send notifications on page load, those notifications may not be relevant to your users or precise to their needs. Lighthouse flags when pages request notification permissions on load:
How this audit fails
If this code contains calls to
and notification permission was not already granted,
then Lighthouse fails the audit.
Under URLs, Lighthouse reports the line and column numbers where your code is requesting permission to send notifications. Remove these calls, and tie the requests to user gestures instead.
If notification permissions was already granted or denied to a page before Lighthouse's audit, Lighthouse cannot determine if the page requests notification permissions on page load. Reset the permissions and run Lighthouse again.
Each Best Practices audit is weighted equally in the Lighthouse Best Practices Score. Learn more in The Best Practices score.
Ask for user's notification permissions responsibly
A better user experience is to offer to send users a specific type of notification, and to present the permissions request after they opt-in.
See Change website permissions for more help.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.