您的位置:首页 > 其它

浏览器推通知给桌面

2015-11-10 10:11 344 查看
<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: