Hi, I am using Notification.requestPermission() , to prompt notification alert in my site. but it is not working as it should and I have to press F5 to refresh the page to get the notification prompt. Can anybody help me out why it is not working. Here is my code
`if (!(“Notification” in window)) {
alert(“This browser does not support desktop notification”);
}
else if (Notification.permission === “granted”) {
console.log(“permission granted”);
}
else if (Notification.permission !== “denied”)
{
Notification.requestPermission().then(function (permission)
{
if (permission === “granted”) {
console.log(“permission granted”);
}
else
{
console.log(“permission blocked”);
}
});
}
`