Hadi Abou Hamzeh
Hadi Abou Hamzeh

Reputation: 144

Chrome browser desktop notification

After updating Google chrome to version 75 the desktop notification stopped working, but it is working fine on Firefox, is there a way to fix this issue or any workaround to display the desktop notification? Thanks in advance. Note the application is web application not chrome extension, below is a sample for the desktop notification

Notification.requestPermission();
new Notification ("Desktop notification example")

Upvotes: 2

Views: 424

Answers (1)

Shababb Karim
Shababb Karim

Reputation: 3733

The new Notification spec is updated. You need to change it to a promise based syntax for notifications now. Code should be something like this:

Notification.requestPermission().then(function(permission) { 
   if(permission === 'granted') {
      new Notification ("Desktop notification example")
   } else {
      console.log('not granted')
   }

})

New specification is written here

Upvotes: 2

Related Questions