Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactJS - FCM not working in safari browser [duplicate]

I am trying to implement FCM push notification in my ReactJS application. It is working in chrome and firefox browser perfectly but facing in an issue in safari browser.

FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).

I also gone through the documentation of firebase also found that it only supports on only 3 browsers.

  • Chrome

  • Firefox

  • Safari

Is there any method to supports in safari browser as well.

like image 213
Reshu Vaish Avatar asked May 20 '18 10:05

Reshu Vaish


People also ask

Does Safari support push notifications?

Web push notifications have been existing on almost all operating systems (Windows, Linux even macOS on desktops and Android on mobiles) and almost all browsers (Chrome, Firefox, MS Edge, Safari, Opera, etc.). The only major operating system which didn't enable web push notifications was iOS.


2 Answers

I was getting error in Safari because FCM is not supported.

Firebase Provides an inbuilt method to check weather FCM supported or not.

    if(firebase.messaging.isSupported()) {
        messaging = initializedFirebaseApp.messaging();
        messaging.usePublicVapidKey(
          "Key"
        );
    }

like image 163
Uddesh Jain Avatar answered Nov 10 '22 13:11

Uddesh Jain


Safari 11.1 already supported serviceWorker, but it still didn't support PushAPI that is also needed by FCM Javascript API.

Taken from Firebase documentation (https://firebase.google.com/docs/cloud-messaging/js/client) :

The FCM JavaScript API lets you receive notification messages in web apps running in browsers that support the Push API.

Here is the supported browser list: https://caniuse.com/#feat=push-api that states that Safari still not supporting Push API

like image 2
Dimitrij Agal Avatar answered Nov 10 '22 13:11

Dimitrij Agal