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

HTML5的桌面提醒消息

时间:2015-11-12 17:57:09      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

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();">
注意,需要在服务器端运行

HTML5的桌面提醒消息

标签:

原文地址:http://www.cnblogs.com/fuxiang-yang/p/4959608.html

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