首页 > 其他 > 详细

浏览器推通知给桌面

时间:2015-11-10 10:37:34      阅读:160      评论:0      收藏:0      [点我收藏+]
<!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>

 

浏览器推通知给桌面

原文:http://www.cnblogs.com/lizhaoyao/p/4952043.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!