2016-01-13 143 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)