JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<!-- Ported from http://jsbin.com/notification/edit -->
<button id="authorize">Authorize notification</button>
<button id="show">Show notification</button>
JavaScript
function authorizeNotification() {
Notification.requestPermission(function(perm) {
alert(perm);
});
}
function showNotification() {
var notification = new Notification("This is a title", {
dir: "auto",
lang: "",
body: "This is a notification body",
tag: "sometag",
});
// notification.onclose = …
// notification.onshow = …
// notification.onerror = …
}
document.querySelector("#authorize").onclick = authorizeNotification;
document.querySelector("#show").onclick = showNotification;