Resetting denied HTML notifications Resetting denied HTML notifications google-chrome google-chrome

Resetting denied HTML notifications


The behavior you’re seeing is by design, as an earlier comment points out. If you read step 2, substep 2 at https://notifications.spec.whatwg.org/#dom-notification-requestpermission you’ll see the spec requires that the only time a user is asked whether showing notifications is acceptable is when the permission value is default. If the permission value is granted or blocked, that algorithm requires that the user is never asked again whether showing notifications is acceptable.

Users who do change their minds about notifications for a site they’ve blocked have the option to go into their browser settings and change their permission settings for that site themselves.


I would recommend having a button to turn notifications on, then checking the permission there, falling back if it's been previously denied.

ex:

  if (Notification.permission === "denied") {    alert("Notifications blocked. Please enable them in your browser.");  }