나는 고객에게 데스크톱 알림을 밀어 코드를 사용 알림 설정을 클라이언트에 알림을 표시하거나 허가를 요청하지 않는 Allowed
또는 Default (Ask)
브라우저로 설정되어있는 동안크롬 데스크톱 알림
// 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);
}
});
}
문제입니다.
위의 코드와 관계없이 Chrome 개발자 도구 콘솔에 Notification.permission
을 입력하면 Allowed
으로 설정되며 입니다.
크롬 버전은 63.x입니다.