javascript - Chrome 浏览器推送通知包含数据?

标签 javascript google-chrome push-notification web-push progressive-web-apps

chrome浏览器弹出一个气球,其中包含如下所示的数据

enter image description here

但是 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 请求。这意味着您必须自己处理所有逻辑,但您可以做很多事情:

  1. 在服务器上维护用户的一些知识或状态,然后将其推送回用户并直接显示通知
  2. 还要掌握一些有关客户端的知识,并从本地数据存储同步软件中的更改,然后据此更新通知。

关于javascript - Chrome 浏览器推送通知包含数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34715052/

相关文章:

google-chrome - 浏览器如何让 WebAssembly Stack Machine 更高效

javascript - 简单语音合成 js 使 Chrome 崩溃并显示 Aw Snap 屏幕

python - 如何在 Python 中跟踪 Chrome 选项卡的 PID?

python - Python 中的 SSLSocket 口令/密码

javascript - 如何使用 JavaScript 测量 DOM 节点内容区域的尺寸?

javascript - 如果错误,请重新选中复选框

ios - 开始使用 iOS 推送通知

ios - 我们如何远程关闭推送通知?

javascript - 无法获取当前行中第一个 TD 的值

javascript - 如何在 three.js 中为三 Angular 形添加纹理?