Created
January 12, 2015 06:04
-
-
Save onerinas/c5c38f8bf2342482d775 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/ziwod
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
<button onclick="notifyMe()"> | |
Notify me! | |
</button> | |
<script id="jsbin-javascript"> | |
function notifyMe() { | |
if (!Notification) { | |
alert('Notifications are supported in modern versions of Chrome, Firefox, Opera and Firefox.'); | |
return; | |
} | |
if (Notification.permission !== "granted") | |
Notification.requestPermission(); | |
var notification = new Notification('Notification title', { | |
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png', | |
body: "Hey there! You've been notified!", | |
}); | |
notification.onclick = function () { | |
window.open("http://stackoverflow.com/a/13328397/1269037"); | |
}; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function notifyMe() { | |
if (!Notification) { | |
alert('Notifications are supported in modern versions of Chrome, Firefox, Opera and Firefox.'); | |
return; | |
} | |
if (Notification.permission !== "granted") | |
Notification.requestPermission(); | |
var notification = new Notification('Notification title', { | |
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png', | |
body: "Hey there! You've been notified!", | |
}); | |
notification.onclick = function () { | |
window.open("http://stackoverflow.com/a/13328397/1269037"); | |
}; | |
} | |
</script> |
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
function notifyMe() { | |
if (!Notification) { | |
alert('Notifications are supported in modern versions of Chrome, Firefox, Opera and Firefox.'); | |
return; | |
} | |
if (Notification.permission !== "granted") | |
Notification.requestPermission(); | |
var notification = new Notification('Notification title', { | |
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png', | |
body: "Hey there! You've been notified!", | |
}); | |
notification.onclick = function () { | |
window.open("http://stackoverflow.com/a/13328397/1269037"); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment