Chrome treats 'default' result from Notification.requestPermission() as 'denied' Chrome treats 'default' result from Notification.requestPermission() as 'denied' google-chrome google-chrome

Chrome treats 'default' result from Notification.requestPermission() as 'denied'


I'll leave this just in case someone is looking for an answer:

When the user had closed the permission dialog for the third time Chrome will automatically set the permission to denied (it shows a automatically blocked message below on the permission popup from the navbar). So the first three times the user close the dialog you gets default as result, but on the third time the permission are set to denied.

The way I'm using to work with this logic is:

window.Notification.requestPermission().then((result) => {  if (result === 'denied') {     // the user has denied permission     return;  }  if (result === 'default') {    // the user has closed the dialog    if (window.Notification.permission === 'denied') {       // the browser has decided to automatically denied permission     }    return;  }  // the user has granted permission});