Notifications With Tags Don't Show On Chrome

Viewed 84

I'm trying to send notifications with a tag.

When I send two notifications with the same tag, I expect the second notification to replace the first one if it's still visible, or to just show up if the first one auto-hided. However, when testing on Chrome, the second notification doesn't show up at all if the first one is already hidden. I have no problems when testing on Firefox.

How can I make this work for Chrome?

Here's my sw.js:

self.addEventListener('push', function (event) {
    const data = event.data.json();
    let notificationData = {
        body: data.body,
        tag: data.tag
    };
    console.log('got notification', data, notificationData);
    let promise = self.registration.showNotification(data.title, notificationData);
    event.waitUntil(promise);
});
0 Answers
Related