So i want my web page to promt for validation on desktop notifications when it loads. So i added onload in body…
<body onload="setAllowNotification() return false;">
This works jsut fine on mozilla firefox but in Google chrome it doesn’t show the question. But if i call that function like this, it works.
<a onclick="setAllowNotification(); return false;" href="#">Click to set allow notifications</a>
If it helps my setAllowNotification function:
function setAllowNotification()
{
window.webkitNotifications.requestPermission(permissionGranted);
}
So any ideas?
Try adding a semicolon to your onload event inline code:Check this answer actually…
Webkit notifications requestPermission function doesn't work
You can only use it as part of a response to a user action – i.e. you cannot do it “onload”