• Chrome 将 Notification.requestPermission() 的“default”结果视​​为“dennied”


    当用户第三次关闭权限对话框时,Chrome 会自动将权限设置为deniedautomatically blocked在导航栏的权限弹出窗口中显示以下消息)。因此,用户关闭对话框的前三次default结果是,但第三次将权限设置为denied

    我用来处理这个逻辑的方式是:

    window.Notification.requestPermission().then((result) => {
      if (result === 'denied') {
         // the user has denied permission
         return;
      }
    
      if (result === 'default') {
        // the user has closed the dialog
        if (window.Notification.permission === 'denied') {
           // the browser has decided to automatically denied permission 
        }
        return;
      }
    
      // the user has granted permission
    });
  • 相关阅读:
    c#文件读取
    asp.net页面缓存学习
    JQuery学习
    如何在asp.net后台调用前台代码
    c#文件操作二
    oracler主键自动增长
    C#委托学习
    小技巧:DIV中显示字符不完整的解决方法
    英文名字的误区及起名方法
    SharePoint 2010 中提供的母版页
  • 原文地址:https://www.cnblogs.com/taoshihan/p/16888731.html
Copyright © 2020-2023  润新知