ReactJS - FCM 在 Safari 浏览器中不起作用
我正在尝试在我的 ReactJS 应用程序中实现 FCM 推送通知.它在 chrome 和 firefox 浏览器中完美运行,但在 safari 浏览器中遇到问题.
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:消息:此浏览器不支持使用 firebase SDK 所需的 API.(消息/不支持的浏览器).
FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).
我还浏览了firebase的文档,发现它只支持3个浏览器.
I also gone through the documentation of firebase also found that it only supports on only 3 browsers.
铬
火狐
Safari
在 safari 浏览器中是否也有任何方法支持.
Is there any method to supports in safari browser as well.
推荐答案
我在 Safari 中遇到错误,因为不支持 FCM.
I was getting error in Safari because FCM is not supported.
Firebase 提供了一种内置方法来检查天气 FCM 是否支持.
Firebase Provides an inbuilt method to check weather FCM supported or not.
if(firebase.messaging.isSupported()) {
messaging = initializedFirebaseApp.messaging();
messaging.usePublicVapidKey(
"Key"
);
}
相关文章