I am using the below code to show notification. But it is not working. Please help me on this
$(document).ready(function(){
if (window.webkitNotifications.checkPermission() == 0) {
var popup = window.webkitNotifications.createNotification
("", "Notifier", "Properties will be displayed like this");
popup.show();
}
});
With the above code I could not see any notification.
I see you’re using
$(document).ready()and perhaps you are also using that kind of thing to request for permission. This cannot be done and must be requested on a user action like the click of a button:http://www.html5rocks.com/en/tutorials/notifications/quick/#toc-step3
Double check your
window.webkitNotifications.checkPermission()value and you might find it’s not actually0unless you request under the condition of a user action.