title: Display custom alert box like facebook when you navigate to other page
body: <p><a href="https://i.stack.imgur.com/08N70.png"><img src="https://i.stack.imgur.com/08N70.png" alt="enter image description here"></a>
  I want to show custom alert box instead of browser default alert box when user tries to navigate from the existing page. Using this code:</p>
  
  <pre><code> window.onbeforeunload = function(){
      return "are you sure?";
   }
  </code></pre>
  
  <p>I can use this code to alert user if he has any unsaved data and want to leave page. But I want to make custom alert box with my own design like facebook does. How it is possible? Something like:</p>
  
  <pre><code> window.onbeforeunload = function(){
      myownalertbox.show();  //here I want to bind leave page or stay on page button with my own button.
   }
  </code></pre>
  
  <p>And I want to bind stay on this page and leave this page button to my button.</p>