I'm using Chrome, I've got everything set up according to many stack overflow posts and google developer docs, however the issue is that the 'push' event doesn't seem to be getting called. Here is my 'push' event...
self.addEventListener('push', event => {
const payload = event.data.json();
event.waitUntil(
self.registration.showNotification('My Website', {
body: payload.message,
icon: 'img/icon-512.png',
vibrate: [100, 50, 100],
data: { url: payload.url }
})
);
});
On a published website the push notification gives me the error 'This site has been updated in the background'. However in local host it accepts the notification sent from my server and displays that, but not the local notification in 'push'. Debugging the push event it seems like its not called.
Aucun commentaire:
Enregistrer un commentaire