Skip to content

Instantly share code, notes, and snippets.

@robertcasanova
Created February 29, 2012 14:50
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 robertcasanova/1941314 to your computer and use it in GitHub Desktop.
Save robertcasanova/1941314 to your computer and use it in GitHub Desktop.
Notifications HTML5
if (window.webkitNotifications) {
if (window.webkitNotifications.checkPermission() == 0) {
var note = window.webkitNotifications.createNotification("", "Hi", "I'm a notification");
note.ondisplay = function(event) {
setTimeout(function() {
event.currentTarget.cancel();
}, 2000);
}
note.show();
}
else {
window.webkitNotifications.requestPermission();
return;
}
}
@robertcasanova
Copy link
Author

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