<!DOCTYPE HTML>
<html>
<body>

Notification

</body>
<script type="text/javascript">
checkNotification();
function checkNotification(){

if (!('Notification' in window)) {

alert('This browser does not support desktop notification');

}

// check whether notification permissions have alredy been granted

else if (Notification.permission === 'granted') {

// If it‘s okay let‘s create a notification

new Notification('Granted!');

}

// Otherwise, 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') {

new Notification('Request granted!');

}

});

}

}

</script>

</html>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2021-12-04
  • 2021-12-04
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2022-01-08
  • 2022-12-23
  • 2022-01-08
  • 2021-06-05
相关资源
相似解决方案