Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <button onclick="notifyMe()">
  6. Notify me!
  7. </button>
  8. <script>
  9. document.addEventListener('DOMContentLoaded', function () {
  10. if (Notification.permission !== "granted")
  11. Notification.requestPermission();
  12. });
  13.  
  14. function notifyMe() {
  15. if (!Notification) {
  16. alert('Desktop notifications not available in your browser. Try Chromium.');
  17. return;
  18. }
  19.  
  20. if (Notification.permission !== "granted")
  21. Notification.requestPermission();
  22. else {
  23. var notification = new Notification('notif anjing', {
  24. icon: 'https://i.pinimg.com/236x/97/9f/69/979f69785f1557b10f46bad8603fa495--crowns-inori-guilty-crown.jpg',
  25. body: "aso lo",
  26. });
  27.  
  28. notification.onclick = function () {
  29. window.open("https://notifications.spec.whatwg.org/");
  30. };
  31.  
  32. }
  33.  
  34. }
  35. </script>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement