navigator.serviceWorker.register('/service-worker.js').then((reg) => {
})
Notification.requestPermission(function(result) {
console.log('User Choice', result);
if (result !== 'granted') {
console.log('No notification permission granted!');
} else {
navigator.serviceWorker.ready
.then(function(swreg) {
console.log("blaxblux");
swreg.showNotification('Successfully subscribed!', {body:'TEST'});
});
}
});
This is my code in main.js
It comes to console.log('blaxblux'), but doesn't show the notification at all. Request permission works as browser shows a popup with allow button.
What things could be the issues?
(I am using latest version of chrome)