简体   繁体   English

HTML5通知和权限问题

[英]Issue with HTML5 Notification and permission

I'm trying to use the new HTML notification API... I'm still stuck in the request authorization phase; 我正在尝试使用新的HTML通知API ...我仍然停留在请求授权阶段; when user click on a button it's executed the function: 当用户单击按钮时,将执行以下功能:

// this is all inside a click handler
var fn = console.info;

window.Notification.requestPermission(function(grant) {
    fn(grant);          
});

When i tryed this for the first time in chrome, a chrome's message came out asking me if i want to concede the Notification grant to my localhost web site... I said no (just to test even this case). 当我第一次在chrome中尝试使用chrome时,出现了chrome消息,问我是否要向我的本地主机网站授予Notification许可...我说不(只是为了测试这种情况)。 Then I tried again, but that message from chrome never came out. 然后我再试一次,但是chrome发出的消息从未发出。

My question: If the user change opinion about notification, how could enable notification for a website? 我的问题:如果用户更改了对通知的看法,如何启用网站通知? Maybe do I've to change something in the chrome settings? 也许我需要在Chrome设置中进行某些更改?

Thanks in advance 提前致谢

You can manage and re-allow notifications in Chrome by going to Settings -> Privacy -> Content Settings -> Scroll down to Notifications - here you can manage which sites are allowed to show notifications and which are not. 您可以转到Settings -> Privacy -> Content Settings -> Scroll down to Notifications通知,在Chrome中管理和重新允许通知。在这里,您可以管理允许显示通知的网站和不允许显示通知的网站。

Update: 更新:

As mentioned by @ivan_vaz in the comments, it is also possible to configure this as well as other permissions by clicking the favicon of the website in the address/navigation bar. 如@ivan_vaz在评论中提到的,也可以通过单击地址/导航栏中的网站的图标来配置此权限以及其他权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM