Skip to content

Instantly share code, notes, and snippets.

@yodeah
Last active May 14, 2017 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yodeah/5c4fedee0da6263c3c63afe8f93ce40d to your computer and use it in GitHub Desktop.
Save yodeah/5c4fedee0da6263c3c63afe8f93ce40d to your computer and use it in GitHub Desktop.
//http://stackoverflow.com/questions/42362235/web-pushnotification-unauthorizedregistration-or-gone-or-unauthorized-sub
document.addEventListener('DOMContentLoaded', function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
});
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('Daggers & Sorcery', {
icon: 'https://www.daggersandsorcery.com/09119ad38663705823233be050aa5b23.png',
body: "Hey there! Your movement points are full. Time for a new adventure!",
});
notification.onclick = function () {
window.open("https://www.daggersandsorcery.com/");
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment