chrome浏览器弹出一个气球,其中包含如下所示的数据
但是 Mozilla 说 PushEvent.data仍处于实验阶段
This is an experimental technology Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
Note: This isn't yet supported on any browser.
现在facebook如何检测5个通知?,他们是否重新建立http连接来检测它?或者它真的是随 PushEvent.data
一起提供的吗?最佳答案
它不是来自 PushEvent.data,该数据尚未在 Chrome 中完全实现。
当前流程是,当 Service Worker 收到推送事件时,您需要从 pushnotification
JS 处理程序内部向服务器发出新的 fetch
请求。这意味着您必须自己处理所有逻辑,但您可以做很多事情:
- 在服务器上维护用户的一些知识或状态,然后将其推送回用户并直接显示通知
- 还要掌握一些有关客户端的知识,并从本地数据存储同步软件中的更改,然后据此更新通知。
关于javascript - Chrome 浏览器推送通知包含数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34715052/