【问题标题】:Chrome web notifications without SSL (bypassing Service Worker)没有 SSL 的 Chrome 网络通知(绕过 Service Worker)
【发布时间】:2015-11-26 09:18:32
【问题描述】:

那么,是否可以在没有 SSL 证书的情况下为 Chrome 实现网络通知? 我想避免在我的网站上安装 SSL,如果有一种方法可以在没有 Service Worker 的情况下发送通知,那就太好了。

【问题讨论】:

    标签: javascript google-chrome service-worker web-notifications


    【解决方案1】:

    您仍然可以使用(旧的)Notification(title, options) 构造函数,它可以在某些(桌面)平台上工作。但是(我猜你知道),它在 Chrome for Mobile (Android) 中不起作用。

    适用于移动版 Chrome 的是基于 ServiceWorker 的 showNotification(title, options) 方法。但是根据Service Workers spec,您只能在secure contexts 中使用Service Worker(为了protect users from the risks associated with insecure contexts)。

    因此,如果您想要一些适用于 Chrome for Mobile 用户的东西,那么答案是,不,如果没有 Service Worker,就无法在 Chrome for Mobile 中使用 Web 通知(同样,如果您没有为您的 Chrome 部署 SSL 证书)网站)。

    【讨论】:

      猜你喜欢
      • 2017-03-03
      • 1970-01-01
      • 2016-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-26
      相关资源
      最近更新 更多