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');