iOS web push navigates to a blank screen after clicking the 'Done' button

Steps to recreate the bug

  1. Add to home screen and subscribe to the web push
  2. Close the PWA (this is an important step if you have the PWA open this bug won't happen)
  3. Then send a push notification to the PWA
  4. You will get push notification everything will be fine till here
  5. There will "Done" button at the top left. Click on it it will result in a blank screen
  6. If you had the PWA open "Done" button will navigate back to the PWA.
  7. How do you make sure the links open inside PWA or hide the "Done" button or make sure clicking on "Done" navigates back to the PWA

This seems to be happening in iOS web push 16.4.1 and 16.5 beta

I am also experiencing this same issue. One idea as a potential work around is to have javascript listen for when the user closes the webpage (clicks "Done") then executes a navigation to the PWA. Obviously this requires you to own the page that the push notification brought you to. I'm also not 100% sure this will work either.

This bug still exists in 17.3.1. The lack of PWA main page can be detected by looking for it in clients.matchAll. If none of the window type clients have a matching URL, then the PWA UI can be restored by invoking clients.openWindow with its URL inside the notificationclick event handler. The problem with that, is that you then cannot open the URL from the notification, because only 1 invocation of openWindow is allowed in the handler. Also window.open() cannot be invoked by the PWA page just like that. One would need to show a banner on that page which the user has to click, and from that click handler, the actual page could then be opened. A major PITA of course, it would be much better if Apple could fix this obvious bug.

iOS web push navigates to a blank screen after clicking the 'Done' button
 
 
Q