HTML5 桌面提示

<!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>  

  

posted @ 2015-03-02 14:11  soft.push("zzq")  Views(111)  Comments(0Edit  收藏  举报