2016-01-13 45 views
0

我写了一个简单的脚本,它应该提示用户获取通知权限。Chrome中的请求通知权限失败

当在Firefox 43运行时,它显示“授予”,而铬47个显示“拒绝”而不提示用户(Firefox不提示以及)。

<html> 
<head> 
</head> 
<body> 
    <script> 
     Notification.requestPermission(function (result) { 

      console.log(result); // Chrome displays "denied" 
     }); 
    </script> 
</body> 

+0

我的铬是好的,也许它有一些主设置,禁用所有的通知? – Surely

回答

0

我可以给你描述的症状,如果我改变浏览器的设置来阻止所有通知。

Settings > Advanced > Content Settings > Notificaitons
Do not allow any site to show notifications - 检查过吗?

您需要将其设置为其他2个选项中的任意一个。一些有用的资源是here (Chrome blog)here (sandbox)

相关问题