首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

HTML5 Notification圆桌面提醒功能,html5 教程

2013-01-27 
HTML5 Notification桌面提醒功能,html5 教程HTML5 Notification桌面提醒功能,html5 教程!DOCTYPE HTMLh

HTML5 Notification桌面提醒功能,html5 教程
HTML5 Notification桌面提醒功能,html5 教程

<!DOCTYPE HTML>
<html>
<head
<meta charset="gbk">
<title>Creating OS notifications in HTML5</title>
</head>
<body>
<input type="button" value="验证授权" onclick="init();" />
<input type="button" value="弹出消息" onclick="notify();" />

const miao = 5;
function init(){
if (window.webkitNotifications) {
window.webkitNotifications.requestPermission();
}
}
function notify() {
if (window.webkitNotifications.checkPermission() == 0) {
var popup = window.webkitNotifications.createNotification("zencart.me.png", "http://zencart.me", " http://zencart.me/archives/905");
popup.ondisplay=(function(event){
setTimeout(function() {
event.currentTarget.cancel();
}, miao * 3000);
});
popup.show();
}else{
window.webkitNotifications.requestPermission();
}
}
HTML5 Notification桌面提醒功能,html5 教程 http://zencart.me/archives/905

热点排行