V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yangwcool
V2EX  ›  Firefox

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

  •  
  •   yangwcool · 2020-02-20 20:14:48 +08:00 · 2349 次点击
    这是一个创建于 1498 天前的主题,其中的信息可能已经有所发展或是发生改变。
    发送通知权限已设置为允许,但还是无法弹出通知,控制台提示“通知权限只能从安全的上下文请求”,这种情况该怎么解决?
    另外,传统版 Edge 可以弹出,Chrome 没测试。
    2 条回复    2020-02-20 21:27:37 +08:00
    DOLLOR
        1
    DOLLOR  
       2020-02-20 20:43:47 +08:00
    “通知权限只能从安全的上下文请求”应该是说,发送通知的代码、网页,必须在 HTTPS 环境中吧。
    Chrome 也是从某个版本开始,禁止非 HTTPS 下发起的通知请求了。
    iNaru
        2
    iNaru  
       2020-02-20 21:27:37 +08:00
    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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1103 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:50 · PVG 02:50 · LAX 11:50 · JFK 14:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.