zoukankan      html  css  js  c++  java
  • 谷歌chrome浏览器桌面提醒 webkitNotifications

     原创:

    //点击时开启提醒

    $(".message_alert").toggle(function(){
    $(".message_alert_tip").html("关闭提醒");
    $(".message_alert").find("img").attr("src","public/images/bell_open.png")
    initNotificatoin(); //打开浏览器开启桌面提醒询问

    },function(){
    $(".message_alert_tip").html("开启提醒");
    $(".message_alert").find("img").attr("src","public/images/bell_close.png")
    alert("要关闭桌面提醒,请设置弹框窗口的右上角按钮");
    })

    //调用弹出框
    systemNotify(icon,title,content) ;
    //打开系统消息 
    function initNotificatoin(){
    if (window.webkitNotifications) {
    window.webkitNotifications.requestPermission();
    }else{
    alert("您的浏览器不支持桌面提醒,请使用谷歌浏览器");
    }
    }
    //系统消息 
    function systemNotify(icon,title,content) {
    if (window.webkitNotifications) {
    if (window.webkitNotifications.checkPermission() == 0) {
    var icon="public/images/service.png";
    var popup = window.webkitNotifications.createNotification(icon, title, content);
    popup.ondisplay = function(event) {
    setTimeout(function() {
    event.currentTarget.cancel();
    }, 5000);
    }
    popup.show();
    } else {
    window.webkitNotifications.requestPermission();
    return;
    }
    }
    }

  • 相关阅读:
    spring cloud 搭建(服务)
    spring cloud 搭建(配置中心)
    spring cloud 搭建(注册中心)
    spring cloud 搭建
    skywalking 配置和使用(windows)
    jenkins 发布报错
    web 显示 pdf
    springmvc Cacheable 不设置key
    iRed邮箱使用情况
    关闭SSL服务[iRedMail]
  • 原文地址:https://www.cnblogs.com/peng14/p/3630523.html
Copyright © 2011-2022 走看看