Last active
May 14, 2017 20:49
-
-
Save yodeah/5c4fedee0da6263c3c63afe8f93ce40d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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