Skip to content

Instantly share code, notes, and snippets.

@snay2
Created February 24, 2011 23:16
Show Gist options
  • Save snay2/843099 to your computer and use it in GitHub Desktop.
Save snay2/843099 to your computer and use it in GitHub Desktop.
Simple Chrome desktop notifications
<html>
<head>
<title>Testing Chrome desktop notifications</title>
<script type="text/javascript" language="javascript">
var icon = 'http://farm1.static.flickr.com/79/245536726_94521c750d_s.jpg';
function showPopup() {
window.webkitNotifications.requestPermission(function() {
var popup = window.webkitNotifications.createNotification(
icon, 'Message Title', 'Message body');
popup.show();
});
}
</script>
</head>
<body>
<a href="#" onclick="showPopup();">Show me a notification!</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment