标签:
function fnShow() { var date = new Date(); var time = date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); Notification.requestPermission(function (perm) { if (perm == "granted") { var notification = new Notification("现在时间:", { dir: "auto", lang: "hi", tag: "testTag", icon: "img/QR.png", body: time }); } }) }
<input type="button" value="桌面提醒显示时间" onClick="fnShow();">
注意,需要在服务器端运行
标签:
原文地址:http://www.cnblogs.com/fuxiang-yang/p/4959608.html