Chrome插件:彈出桌面通知

if (window.Notification) {
        var popNotice = function() {
            if (Notification.permission == "granted") {
                var notification = new Notification("信息"
                    , {
                     body:"你好",
                   // icon:圖片地址,
                   
                       }
                );
                notification.onclick = function() {
                    notification.close();    
                };
            }    
        };
            if (Notification.permission == "granted") {
                popNotice();
            } else if (Notification.permission != "denied") {
                Notification.requestPermission(function (permission) {
                  popNotice();
                });
            }
    } else {
        alert('瀏覽器不支持Notification');    
相關文章
相關標籤/搜索