[scode type="green"]网站右下角弹窗代码[/scode]
食用方法:放在footer文件里面

    <script>
var popNotice = function() {
//获取用户授权状态
if (Notification.permission == "granted") {
var notification = new Notification("Hi,欢迎光临 清墨的橘 个人博客", {
//很明显这是正文
body: '有生之年,换路相逢,终不能幸免!',

//很明显这是图标
icon: 'https://yun.342600.xyz/tx.png'
});
//消息被点击事件
notification.onclick = function() {
//alert('有爱便无需多言!!!');
//窗口关闭动作
notification.close();
};
//消息被关闭事件
notification.onclose = function() {
//alert('你不爱我了');
notification.close();
};
//消息出现错误事件
notification.onerror = function() {
alert('上帝也不知道发生了什么');
notification.close();
};
}
};

if (window.Notification) {
if (Notification.permission == "granted") {
popNotice();
}else if( Notification.permission != "denied"){
Notification.requestPermission(function (permission) {
popNotice();
});
}
} else {
alert('垃圾浏览器不支持Notification');
}
</script>

1.png