javascript 如何重置请求许可 chrome 桌面通知

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15973880/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 02:47:25  来源:igfitidea点击:

How to reset asking for permission for chrome desktop notification

javascripthtmlgoogle-chrome

提问by Ian Davis

window.webkitNotifications.requestPermission()originallyshowed the prompt to the user asking them to Allowor Deny. At one point, when my notification showed up, I clicked on the little wrench and then Disable from http://example.comoption.

window.webkitNotifications.requestPermission()最初向用户显示提示,要求他们使用AllowDeny。有一次,当我的通知出现时,我点击了小扳手,然后点击了Disable from http://example.com选项。

Then, window.webkitNotifications.requestPermission()no longer prompted me. Did I permanently stop my site from receiving or even allowing to request for permission? I even went into Chrome settings and opted in for "allow notifications from all sites."

然后,window.webkitNotifications.requestPermission()就不再提示我了。我是否永久阻止我的网站接收甚至允许请求许可?我什至进入了 Chrome 设置并选择了“允许来自所有站点的通知”。

How can I get that prompt to show up again? Currently, .checkPermission()is 1, and I want to make it 0again.

我怎样才能让那个提示再次出现?目前,.checkPermission()1,我想再做0一次。

回答by Goodwine

You disabled notifications for that website locally-only. So only you will have this "problem", and the other users will be fine.

您仅在本地禁用了该网站的通知。所以只有你会有这个“问题”,其他用户会没事的。

About the Chrome setting to "Allow notifications from all sites", this will only allow websites to request for permissions, but in your case... you already disabled the notifications specifically for that domain.

关于 Chrome 设置为“允许来自所有站点的通知”,这将只允许网站请求权限,但在您的情况下......您已经专门为该域禁用了通知。

To re-enable it, follow the example in the image below to find the way to the permission settings per domain. In there, you can see "Notifications". Just update your settings, and you are good to go ;)

要重新启用它,请按照下图中的示例找到每个域的权限设置的方法。在那里,您可以看到“通知”。只需更新您的设置,您就可以开始了;)

More info at: http://support.google.com/chrome/bin/answer.py?hl=en&answer=95617

更多信息请访问:http: //support.google.com/chrome/bin/answer.py?hl=zh-CN&answer=95617

Permissions

权限