Skip to content

Instantly share code, notes, and snippets.

@wtfaremyinitials
Created April 23, 2015 19:04
Show Gist options
  • Save wtfaremyinitials/13935fb64b72ca795b73 to your computer and use it in GitHub Desktop.
Save wtfaremyinitials/13935fb64b72ca795b73 to your computer and use it in GitHub Desktop.
Desktop notifications in Javascript
function notify(message, iconUrl, onclick) {
if (!Notification) {
alert(message);
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
var notification = new Notification('', {
icon: ironUrl,
body: message,
});
notification.onclick = onclick;
}
Copy link

ghost commented Mar 12, 2018

You made a mistake in the part that says icon: ironUrl, it should be iconUrl not ironUrl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment