【发布时间】:2017-12-29 00:27:13
【问题描述】:
当我使用 localhost 时如何启用浏览器通知,在控制台 Notification.requestPermission(); 中写入时,什么都不会出现,但在任何常规站点上,在控制台 Notification.requestPermission(); 中写入请求权限。
如何启用它来测试我的代码? 非常感谢您提前...
【问题讨论】:
-
您好,欢迎来到 StackOverflow。请花一些时间阅读帮助页面,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。更重要的是,请阅读the Stack Overflow question checklist。您可能还想了解Minimal, Complete, and Verifiable Examples。
-
我无法重现该问题。也许您已经阻止了该来源的通知权限。
-
我没有被屏蔽我确定这一点
-
您需要在您的域上拥有 SSL,因此您无法在没有 SSL 的本地主机上执行此操作。您可以将其添加到 chrome 上的安全 url 列表中以使其正常工作。
标签: javascript browser localhost