简体   繁体   中英

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; 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). Then I tried again, but that message from chrome never came out.

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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