码迷,mamicode.com
首页 > Web开发 > 详细

HTML5 桌面提示

时间:2015-03-02 14:49:46      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>  
<html>  
<head>  
<meta charset="utf-8" />  
<title>Desktop Notification</title>  
</head>  
<body>  
<div id="a"></div>
  <script>  
	var showDekInfo = function () {
		Notification.requestPermission(vcallBack);
	}

	var vcallBack = function (perm) {
		    if(perm == "granted") {
				var na = new Notification("title", {
					  dir: "auto",    
				       lang: "hi",    
				       tag: "testTag",    
				       icon: "http://www.html5party.com/bbs/static/image/common/logo.png",    
			    	       body: "content"    
				});
				na.onshow = function () { document.getElementById("a").innerHTML = "载入时发生了onshow事件"; }
				na.onclick = function () { document.getElementById("a").innerHTML = "载入时发生了onclick事件"; }
				na.onclose = function () { document.getElementById("a").innerHTML = "载入时发生了onclose事件"; }
			}
	     }

	onload = function () {
		showDekInfo();
	}
  </script>  
</body>  
</html>  

  

HTML5 桌面提示

标签:

原文地址:http://www.cnblogs.com/zzq-include/p/4308645.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!