javascript - 用户允许获取 Chrome 浏览器通知后如何刷新或重定向用户?

标签 javascript google-chrome push-notification

在用户按下通知弹出窗口中的[允许]按钮后,Chrome 中是否可以使用 JavaScript 或 PHP 刷新页面或将用户重定向到特定页面(通知请求弹出窗口示例:http://prntscr.com/7ataxu)?

最佳答案

https://developer.mozilla.org/en-US/docs/Web/API/notification

 Notification.requestPermission(function (permission) {
      // If the user accepts, let's create a notification
      if (permission === "granted") {
        //redirect using javascript here window.location
      }
    });

关于javascript - 用户允许获取 Chrome 浏览器通知后如何刷新或重定向用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30535356/

相关文章:

windows-phone-7 - 与对服务器的正常请求相比,原始通知有何优势?

Javascript - 将数字转换为月份名称

javascript - 在按钮处于事件状态时在新选项卡中打开链接

javascript - 网络错误 : XMLHttpRequest Exception 101

javascript - 在 Chrome 应用中使用 Fabric.js

html - margin-left(以百分比设置)随着 Chrome 中的每个元素缩小(而不是在 Firefox 中)

iOS,删除应用程序未像 gmail 应用程序那样运行的通知

android - 在 android 上使用 phonegap 设置 Urban Airship 推送通知

javascript - Angular 6 响应式(Reactive)表单验证不适用于自定义验证器

javascript - 从 python cgi 执行 Javascript 时出现问题