Saturday, October 28, 2017

Display Browser Notifications from Web Application

Browser desktop notification system helps to push the new updates notification in web application using browser. This notification system is quite bit similar to android notification. we are providing the source which helps you to integrate notification system in application and through which you get the real time updates.

Note: Use this Chrome and Firefox Browser.
Desktop Notification - Best Push Notifications Online skptricks

Lets see the below source code :

Notification.html
<html>
  <head>
    <style>
      .button {
      background-color#00BFFF ;
      font-weightbold;
      padding12px 15px;
      color#ffffff;
      }
    </style>
    <script>
      // request permission on page load
      document.addEventListener('DOMContentLoaded', function () {
        if (!Notification) {
          alert('Desktop notifications not available in your browser. Try Chromium.'); 
          return;
        }
      
        if (Notification.permission !== "granted")
          Notification.requestPermission();
      });
      
      function notifyBrowsertitledescription link ) {
        if (Notification.permission !== "granted")
          Notification.requestPermission();
        else {
          var notification = new Notification(title, {
            icon'icon.png',
            bodydescription,
          });
      
          notification.onclick = function () {
            window.open(link);      
          };
      
        }
      
      }
    </script>
  </head>
  <body>
    <button class="button" onclick="notifyBrowser('Skptricks updates','New Post: Submit Checkbox values in Form with JQuery','http://www.skptricks.com')">Notify me!</button>
  </body>
</html

Video Link 





Download Link : https://github.com/skptricks/php-Tutorials/tree/master/Display%20Browser%20Notifications%20from%20Web%20Application

No comments:

Post a Comment