file_dom_notifications.html (777B)
1 <html> 2 <head> 3 <meta charset="utf-8"> 4 <script> 5 "use strict"; 6 7 function showNotification1() { 8 var options = { 9 dir: undefined, 10 lang: undefined, 11 body: "Test body 1", 12 tag: "Test tag", 13 icon: undefined, 14 }; 15 var n = new Notification("Test title", options); 16 n.addEventListener("click", function(event) { 17 event.preventDefault(); 18 }); 19 return n; 20 } 21 22 function showNotification2() { 23 var options = { 24 dir: undefined, 25 lang: undefined, 26 body: "Test body 2", 27 tag: "Test tag", 28 icon: undefined, 29 }; 30 return new Notification("Test title", options); 31 } 32 </script> 33 </head> 34 <body> 35 <form id="notificationForm" onsubmit="showNotification();"> 36 <input type="submit" value="Show notification" id="submit"/> 37 </form> 38 </body> 39 </html>