safariapple-push-notifications

Local (Browser) Notifications in iOS Safari standalone mode


Do Local Notifications work at all in iOS Safari or standalone apps? I don't mean Push Notifications with service workers, but the ones initiated from the browser with new Notification().

There isn't any result from new Notification().

Permissions are granted; the context is secure; the app is added to the Home Screen; "Notifications" flag in Safari Advanced WebKit settings is turned on.


Solution

  • Local notifications using new Notification() don't work as expected in iOS Safari or standalone web apps added to the Home Screen.

    Here’s why:

    In Safari: Local notifications (not push notifications) aren't supported, even if permissions are granted. They typically only work in the context of service workers and push notifications. Home Screen PWAs: Notifications should work for PWAs, but only via push notifications, not directly with new Notification(). These require a service worker to handle the push event. User Interaction: For new Notification() to work in Safari, it must be triggered by a user action (like a click) while the app is in the foreground. Solution: If you need notifications in a web app, use Push Notifications with a service worker, which is the recommended approach on iOS.