notificationclick event not triggered if the progressive web app(pwa) is not opened

Hello, notificationclick event cannnot be triggered if the progressive web app(pwa) is already opened.

I have tried many methods including

  • client.focus()
  • clients.openWindow()
  • client.postMessage() message event listening
  • Delayed message queue (to let the client being opened)
  • preventDefault() in notificationclick event
  • Activation
  • event.waitUntil()

The situation is that when the device install the pwa twice, the second pwa works normally. However, it is nonsense to ask users install the pwa twice.

Is it a bug in Webkit and will it be fixed in the future? is there a workable example?

Background: using web-push, iOS 17/18

Thanks a lot

notificationclick event not triggered if the progressive web app(pwa) is not opened
 
 
Q