标签:指定 路径 默认 ant miss var ssi new not
<a onclick="showNotification();">show Notification</a>
<script>
function showNotification () {
window.Notification.permission = "granted";
alert(window.Notification.permission);
if (window.Notification){
if (window.Notification.permission == "granted") {
var notification = new Notification(‘标题‘, {
body: "内容",
icon: "图标路径,若不指定默认为favicon"
});
setTimeout(function(){notification.close();},5000);
} else {
window.Notification.requestPermission();
}
}else alert(‘你的浏览器不支持此消息提示功能,请使用chrome内核的浏览器!‘);
};
</script>
标签:指定 路径 默认 ant miss var ssi new not
原文地址:http://www.cnblogs.com/gggzly/p/6378517.html