JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function notify() {
var havePermission = window.webkitNotifications.checkPermission();
if (havePermission == 0) {
// 0 is PERMISSION_ALLOWED
var notification = window.webkitNotifications.createNotification(
'http://test.didacticmedia.ro/img/didactic.png',
'Notification test!',
'details text'
);
notification.onclick = function () {
window.open("http://stackoverflow.com/questions/18414462/chrome-rich-notifications-in-normal-web-pages/19031405#19031405");
notification.close();
}
notification.show();
} else {
window.webkitNotifications.requestPermission();
}
}
</script>
<div style="width: 100px; height: 100px; background: red" onclick="notify()">
Click here!
</div>