0
我使用此代碼桌面通知推送到客戶端:Chrome的桌面通知
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
toast(type, title, body);
}
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification(title, options);
}
// Otherwise, we need to ask the user for permission
else if (Notification.permission !== 'denied') {
Notification.requestPermission(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification(title, options);
} else {
// toast(type, title, body);
}
});
}
的問題是同時通知設置設爲Allowed
或Default (Ask)
瀏覽器不顯示通知客戶,也不要求准予使用。
無論上面的代碼是什麼,當我在Chrome開發者工具控制檯中鍵入Notification.permission
時,它是denined
(同樣,它設置爲Allowed
)
鉻版本是63.x.