Push notifications in Apple Safari with FCM

We implemented push notifications using FCM in chrome and firefox and it worked fine, but Safari does not support Service Workers, which is required by FCM.

Has anyone dealt with such problems? any suggestions?

+10


source to share


3 answers


While worker services are working on Safari, there aren't enough of them.

The documentation says:



The FCM JavaScript API allows you to receive notifications in web applications that run on browsers that support the Push API . This includes the browser versions listed in this support matrix .

Safari does not support web push , which FCM uses to support the browser. This means Safari cannot receive FCM notifications.

+5


source


I'm not sure about this new Safari and Service Workers situation, but I tried to implement FCM push notifications in my iOS app and had to first make sure you need an APN (Apple-Push-Notification) certificate. I'm not sure if this is necessary if you are working with Safari, but I could imagine that Apple also wants it to notify redirect notifications to APN servers first.



+2


source


Safari still doesn't support the Web Push API, so the Firebase Cloud Messaging.

Here are the supported browsers in Firebase: https://firebase.google.com/support/guides/environments_js-sdk#browsers

I would suggest using .isSupported()

instead of other solutions.

if (firebase.messaging.isSupported())
    const messaging = firebase.messaging();
}

      

For more information about .isSupported()

, see. In documentation .

0


source







All Articles