Safari push setup
Safari supports standard web push on macOS 13 and later, and on iPhone and iPad from iOS 16.4 for web apps added to the Home Screen. What each needs.
Updated
Safari supports the same standards-based web push as other browsers: the Push API, the Notifications API and VAPID. On the Mac it works in Safari 16 and later on macOS 13 Ventura and later. On iPhone and iPad it works from iOS and iPadOS 16.4, but only for a web app the user has added to their Home Screen. No Apple Developer Program membership is needed for either.
Safari on the Mac
If your site already sends web push to Chrome or Firefox using VAPID, it should work in Safari on macOS 13 or later without Safari-specific code, provided you follow these rules:
- Ask for permission from a user gesture. Call
Notification.requestPermission()inside a click handler. A request made on page load is ignored. - Always show a notification. Subscribe with
userVisibleOnly: trueand callshowNotification()for every push. Safari does not support silent push, and a site that receives pushes without showing notifications can lose its subscription. - Detect features, not browsers. Check for
'PushManager' in windowinstead of reading the user agent. - Allow Apple's push hosts. Safari subscription endpoints are on subdomains of
push.apple.com. If your server restricts outbound requests, allow them.
Older versions of Safari on the Mac used a separate, Apple-specific system called Safari Push Notifications, which needed an Apple developer account and a website push ID. New work should use the standard API.
iPhone and iPad
Web push on iOS and iPadOS has one large extra condition: the site must be installed as a Home Screen web app.
What you need
- A web app manifest linked from your pages, with
displayset tostandaloneorfullscreen:
{
"name": "Example App",
"short_name": "Example",
"start_url": "/",
"display": "standalone",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" }
]
}
- The user adds the site to their Home Screen using Share, then Add to Home Screen.
- The user opens the app from the Home Screen icon, and you request permission there, from a tap.
In an ordinary Safari tab on iOS, the Push API is not available, so 'PushManager' in window is false. Your interface should handle that case by explaining how to install the app, not by showing a button that does nothing.
Detecting the installed state
const isStandalone =
window.matchMedia('(display-mode: standalone)').matches ||
window.navigator.standalone === true;
const canPush = 'serviceWorker' in navigator && 'PushManager' in window;
navigator.standalone is a Safari-specific property; the display-mode media query is the standard check. If canPush is false on an iPhone and isStandalone is false, show install instructions.
Checklist when it does not work
- Is the page served over HTTPS?
- Was the permission request triggered directly by a tap or click?
- On iOS: is the device on 16.4 or later, was the app opened from the Home Screen icon, and does the manifest set
displaytostandaloneorfullscreen? - Does the service worker call
showNotification()insideevent.waitUntil()for every push? - Has the user turned notifications off for the site or app in system settings?
- Is your server getting a
201response from the push endpoint? A404or410means the subscription no longer exists.
For the underlying flow, see how web push works.