ReactJS - FCM not working in safari browser(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"
);
}
这篇关于ReactJS - FCM 在 Safari 浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ReactJS - FCM 在 Safari 浏览器中不起作用
基础教程推荐
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
