Libraryless. Click here for Pure Java version (2662L/17K).
// 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); ]]); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1028545 |
| Snippet name: | hdesktopNotifications |
| Eternal ID of this version: | #1028545/5 |
| Text MD5: | a03eaee833e84289d056f1432f37f495 |
| Transpilation MD5: | e09006f04e824890ace095819452242f |
| Author: | stefan |
| Category: | javax / html |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-06-27 15:37:17 |
| Source code size: | 1102 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 400 / 532 |
| Version history: | 4 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |