发送通知权限已设置为允许,但还是无法弹出通知,控制台提示“通知权限只能从安全的上下文请求”,这种情况该怎么解决?
另外,传统版 Edge 可以弹出,Chrome 没测试。
另外,传统版 Edge 可以弹出,Chrome 没测试。
1
AV1 Feb 20, 2020
“通知权限只能从安全的上下文请求”应该是说,发送通知的代码、网页,必须在 HTTPS 环境中吧。
Chrome 也是从某个版本开始,禁止非 HTTPS 下发起的通知请求了。 |
2
iNaru Feb 20, 2020
In Chrome and Firefox you cannot request notifications at all unless the site is a secure context (i.e. HTTPS), and you can no longer allow notification permissions to be requested from cross-origin <iframe>s.
developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API#Requesting_permission |