失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Web聊天窗口提示框

Web聊天窗口提示框

时间:2021-10-10 15:27:26

相关推荐

Web聊天窗口提示框

收藏了一段Web聊天提示代码,分享一下!!

<script type="text/javascript">

function check() {

// Let's check if the browser supports notifications

if (!("Notification" in window)) {

alert("This browser does not support desktop notification");

}

if (Notification.permission !== "granted") {

Notification.requestPermission(function (permission) {

// Whatever the user answers, we make sure we store the information

if (!('permission' in Notification)) {

Notification.permission = permission;

}

});

}

}

function notifyMe() {

check();

if (1 == 2) {

var notification = new Notification("Hi there!");

}

else {

var notification = new Notification('新的消息', {

icon: 'https://developer./static/img/opengraph-logo.dc4e08e2f6af.png',

body: "Hey there! You've been notified!",

});

notification.onclick = function () {

window.open("/liunianqingshi");

};

}

}

</script>

如果觉得《Web聊天窗口提示框》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。