Hoisting explanation with best 5 example in java script – datainflow
Desktop notification code example: A desktop notification is a way to notify user about important events. You can use it in your browser using this code. The desktop notification use if the browser or tab is inactive or minimized.
This increase the user experience and also keeps the user engage with your applications.
I have developed Desktop notifications which look like this. In this we have option to put icon, title and body text.
Code Example:
<html> <head> <script> document.addEventListener('DOMContentLoaded', function () { if (!Notification) { alert('Desktop notifications is not available in this browser. Try Chorme.'); return; } if (Notification.permission !== "granted") Notification.requestPermission(); }); function notifyMe() { if (Notification.permission !== "granted") Notification.requestPermission(); else { var notification = new Notification('Daily Helper', { icon: 'dailyhelper.png', body: "Our New App coming soon!", }); notification.onclick = function () { window.open("https://play.google.com/store/apps"); }; } } </script> </head> <body> <button onclick="notifyMe()">Daily Helper!</button> </body> </html>
It’s hep for you. If any problem comment us.
Related posts