Chrome notifications
by lemon kazi
HTML
<div id="log">
</div>
JavaScript
if (Notification.permission !== "granted") {
Notification.requestPermission();
};
var timer = setInterval(function() {
//$('#log').append('<p>Tick</p>');
notifyMe();
}, 1000);
function notifyMe() {
if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification('Information', {
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
body: "Hey there! You've been notifiednotifiednotifiednotifiednotifiednotifiednotifiednotifiednotifiednotifiednotified!",
});
}
}