默认是只能在HTTPS中使用,但是可以修改浏览器实现http的使用
Chrome浏览器,
chrome://flags/ 进入设置
Insecure origins treated as secure
中填写需要开启 Notification API 的域名,重启浏览器,就可以在 HTTP 中使用 Notification API 了。
如果是局域网IP,写法如下:
看到效果:
默认是只能在HTTPS中使用,但是可以修改浏览器实现http的使用
Chrome浏览器,
chrome://flags/ 进入设置
Insecure origins treated as secure
中填写需要开启 Notification API 的域名,重启浏览器,就可以在 HTTP 中使用 Notification API 了。
如果是局域网IP,写法如下:
看到效果: