Web聊天窗口提示框

10 篇文章 0 订阅

收藏了一段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.cdn.mozilla.net/static/img/opengraph-logo.dc4e08e2f6af.png',
                body: "Hey there! You've been notified!",
            });


            notification.onclick = function () {
                window.open("http://blog.csdn.net/liunianqingshi");
            };


        }
    }
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值