Skip to content

Instantly share code, notes, and snippets.

@AleksLitynski
Created March 17, 2014 01:06
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 AleksLitynski/9592212 to your computer and use it in GitHub Desktop.
Save AleksLitynski/9592212 to your computer and use it in GitHub Desktop.
notifications only show via file, not http
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script>
function show_notification(){
//http://www.w3.org/TR/notifications/
//tags are for shared notes. If gmail is open twice, they cannot know
//about each other, but if the alert for an email tries to pop up twice,
//but are tagged the same (via server coordiantion) they won't display
//twice
var notification = new Notification("note name",
{ icon: "dog.jpg", tag: "test-note-xxx", body:"note body" });
notification.onclick = function()
{ console.log("got me") }
//onerror, onclose, onshow
//notifications.close()
//clicking the note seems to bring it to the fore, X-ing it doesn't
}
setTimeout(show_notification, 1000);
</script>
</head>
<body>
heh
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment