Skip to content

Instantly share code, notes, and snippets.

@prasanthj
Created December 15, 2014 19:57
Show Gist options
  • Save prasanthj/cd5b54b91249e2643f46 to your computer and use it in GitHub Desktop.
Save prasanthj/cd5b54b91249e2643f46 to your computer and use it in GitHub Desktop.
Browser notification
function notifyMe(url) {
if (!Notification) {
alert('Notifications are supported in modern versions of Chrome, Firefox, Opera and Firefox.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
var notification = new Notification('Site is up!', {
icon: 'thumbs-up.png',
body: "Hey there! " + url + " is back online now!",
});
notification.onclick = function () {
window.open(url);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment