我想询问有关通知的信息现在我有这个通知与“通知我”按钮返回此通知通知允许但我仍然使用此按钮来触发推送通知<button onclick="notifyMe()">Notify me!</button>这是贾夫脚本函数 function notifyMe() { function AutoRefresh( t ) { setTimeout("location.reload(true);", t); } // Let's check if the browser supports notifications if (!("Notification" in window)) { alert("This browser does not support desktop notification"); } // Let's check whether notification permissions have already been granted else if (Notification.permission === "granted") { // If it's okay let's create a notification var notification = new Notification("Hi there!"); } // Otherwise, we need to ask the user for permission else if (Notification.permission !== "denied") { Notification.requestPermission().then(function (permission) { // If the user accepts, let's create a notification if (permission === "granted") { var notification = new Notification("Hi there!"); } }); } }我想要的是通知自动显示,而无需按钮触发如何做到这一点?
添加回答
举报
0/150
提交
取消