Push notifications in Apple Safari with FCM

前端 未结 3 1322
囚心锁ツ
囚心锁ツ 2020-12-03 20:55

We implemented push notifications using FCM in chrome and firefox and it worked fine, but Safari doesn\'t support Service Workers which is mandatory for FCM.

Did any

3条回答
  •  甜味超标
    2020-12-03 21:37

    Safari still does not support Web Push API, thus Firebase Cloud Messaging service.

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

    I'd suggest using .isSupported() instead of other solutions.

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

    See the documentation for details on .isSupported().

提交回复
热议问题