All Collections
Web Push Notifications
Why iOS push notifications sometimes don't redirect to the correct URL in a PWA
Why iOS push notifications sometimes don't redirect to the correct URL in a PWA

Confused about why the notificationclick event is never fired in iOS PWAs?

Kevin Basset avatar
Written by Kevin Basset
Updated over a week ago

When tapped under particular circumstances, notifications sent by PWAs installed on an iPhone or iPad will sometimes focus the app without redirecting to the intended URL.

This problem is due to an iOS bug not specific to Progressier. Every single push notification out there suffers from the same issue.

Steps to reproduce the issue

The problem manifests under specific conditions, making it somewhat challenging to reproduce:

  1. Installation Conditions: The device should not be connected to a power source during the installation of the PWA to the home screen.

  2. App State: The app must be actively running, either in the foreground or background.

  3. Opening Method: The app should have been launched by tapping its icon on the home screen, not through a notification.

If all the above conditions are met, tapping on a push notification will only bring the app into focus without redirecting to the associated URL.

If any of these conditions are not met (e.g. your iPad was plugged in when the PWA was installed, or the app isn't currently open, or the app was opened by another notification), then the notification behaves as expected.

Why this happens

When the three conditions above are met, it appears that the notificationclick event is simply never fired by the service worker. Therefore any logic wrapped in the notificationclick event handler meant to open the URL of the notification is never invoked.

Any workarounds?

As this bug prevents your code from detecting when a notification is tapped, any workaround may compromise user experience. One potential solution is to direct the app to the notification's URL upon receipt rather than on click. However, that means that you may unwantedly interrupt a user session. This solution causes more harm than good, so Progressier and most other push solutions do not support it.

Useful links

There have been many different reports of the problem:

However, as of iOS 17.4, Apple doesn't appear to have issued any fix yet.

Did this answer your question?