// requires JQuery sS hdesktopNotifications() { ret hscript([[ function sendDesktopNotification(text, options) { if ("Notification" in window && Notification.permission === "granted") new Notification(text, options); } window.sendDesktopNotification = sendDesktopNotification; function initDesktopNotifications() { if (!("Notification" in window)) $("#notiStatus").html("Desktop notifications not supported in this browser"); else if (Notification.permission === "granted") $("#notiStatus").html("Desktop notifications enabled"); else if (Notification.permission === "denied") $("#notiStatus").html("Desktop notifications denied"); else { $("#notiStatus").html("Requesting permission for desktop notifications"); Notification.requestPermission().then(function (permission) { initDesktopNotifications(); sendDesktopNotification("Notifications will look like this!"); }); } } $(document).ready(initDesktopNotifications); ]]); }