那么,是否可以在没有SSL证书的情况下为Chrome实施网络通知? 我想避免在我的网站上安装SSL,如果有一种方法可以在没有Service Worker的情况下发送通知,那将会很酷。
答案 0 :(得分:7)
您仍然可以使用(旧)Notification(title, options)
构造函数,它可以在某些(桌面)平台上运行。但是(我猜你知道),它在Chrome for Mobile(Android)中不起作用。
Chrome for Mobile的工作原理是基于ServiceWorker的showNotification(title, options)
方法。但根据Service Workers spec,您只能在secure contexts中使用服务工作者(以protect users from the risks associated with insecure contexts为准)。
因此,如果您想要一些适用于Chrome移动版用户的内容,那么答案是,不,在没有服务工作者的情况下,无法在Chrome浏览器中使用网络通知(所以,如果没有为您的部署SSL证书)位点)。