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();">注意,需要在服务器端运行
时间: 2024-11-01 08:39:48