yangwcool
V2EX  ›  Firefox

Firefox 无法弹出 Notification 有没有遇到过

  •  
  •   yangwcool · Feb 20, 2020 · 3100 views
    This topic created in 2313 days ago, the information mentioned may be changed or developed.
    发送通知权限已设置为允许,但还是无法弹出通知,控制台提示“通知权限只能从安全的上下文请求”,这种情况该怎么解决?
    另外,传统版 Edge 可以弹出,Chrome 没测试。
    2 replies    2020-02-20 21:27:37 +08:00
    AV1
        1
    AV1  
       Feb 20, 2020
    “通知权限只能从安全的上下文请求”应该是说,发送通知的代码、网页,必须在 HTTPS 环境中吧。
    Chrome 也是从某个版本开始,禁止非 HTTPS 下发起的通知请求了。
    iNaru
        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
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5701 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 06:41 · PVG 14:41 · LAX 23:41 · JFK 02:41
    ♥ Do have faith in what you're doing.