답변 1개
채택된 답변
+20 포인트
잘 되는것 같습니다.
Copy
if (!('Notification' in window)) {
alert("데스크톱 알림을 지원하지 않는 브라우저입니다.");
} else {
Notification.requestPermission().then((result) => {
if (result == 'denied') {
alert('알림을 차단하셨습니다.\n브라우저의 사이트 설정에서 변경하실 수 있습니다.');
} else if (result == 'granted') {
alert('허용');
}
});
}
답변을 작성하려면 로그인이 필요합니다.