Black Friday Sale : Get 20% OFF on all plans. promo code: ENGBF2022

Is it possible to send Web push in iOS Safari. This is one of the most frequently asked questions by developers. I began to hear this question since I started my first product that dealt with web push notifications in 2017. Even now, it is one of the most searched term by both marketers and developers. Along with email, in-app, sms , mobile app push notifications, web push is an important channel to communicate with users. So the real question is - Is it possible to send web push notifications in Safari iOS? Let’s figure out.

Web Push Notifications in iOS Safari. Is it possible yet?

The answer is, unfortunately, No! But don’t lose your hope yet. This No is different from the previous “No”s you’ve been hearing for the last few years. Why? Read below.

What is the current state of iOS web push notifications?

Well, finally Apple has officially announced that support for web push notifications in Safari will be available in iOS 16. Yes, iOS 16 is already live but it is not currently enabled. This functionality will be enabled later in 2023 with an update to iOS 16. So, we’re only a few months away from sending web push notifications to our iOS users!

If you check the “Experimental Features” section on iOS Safari settings, you can already see Push API listed there. But as of now, it is not functional.

Is it only for iOS Safari, what about Mac Safari?

Not just iOS, Web push notification is available in Mac Safari as well. As stated in the Apple website, the functionality is already available in Safari 16 running on MacOS 13. Apple has published a documentation on web push notification setup in safari

How to send web push notifications in iOS Safari?

Sending web push notifications in iOS Safari will be similar to that of other browsers such as Chrome, Firefox etc. Because the Push API is a standard W3C feature. So, you’ll have to implement the same procedure using VAPID Keys.

Once web push notification support is enabled in Safari, you can use the following code to send notifications.

// Use serviceWorker.ready to ensure that you can subscribe for push
navigator.serviceWorker.ready.then(
  (serviceWorkerRegistration) => {
    const options = {
      userVisibleOnly: true,
      applicationServerKey,
    };
    serviceWorkerRegistration.pushManager.subscribe(options).then(
      (pushSubscription) => {
        console.log(pushSubscription.endpoint);

      }, (error) => {
       
        console.error(error);
      }
    );
  });

Final Thoughts

Finally, the wait is almost over. We expect Apple to release the most awaited web push notification feature to Safari in iOS. Keep watching this space to get updates.

Read similar articles

Update cookies preferences