zoukankan      html  css  js  c++  java
  • Web Notification简单实现桌面消息通知(右下角提示)

    js代码:

    //新信息桌面右下角提示
    function mesgNotice(){
        if(window.Notification && Notification.permission !== "denied") {
            Notification.requestPermission(function(status) {
                var notice_ = new Notification('新的消息', { body: '您有新的消息'}); 
                notice_.onclick = function() {//单击消息提示框,进入浏览器页面
                    window.focus();
                }
            });
        }    
    }
    

    浏览器通知权限选择(请选允许)

    效果图:

  • 相关阅读:
    新的知识点
    知识点
    9.14知识点
    列表内容
    css的背景和边框
    css的text和font
    css
    js 第一天
    浏览器的差距
    布局
  • 原文地址:https://www.cnblogs.com/ai211234/p/6409802.html
Copyright © 2011-2022 走看看