title: Javascript window close event rather than unload event for all browsers
body: <p>I want to alert a user while the user tries to close the browser with out siginingoff or without saving some settings.</p>
  
  <p>I am ding unload option in another page to alert unload data, but how can i alert a user on window.close(its not taking)</p>
  
  <pre><code>window.onbeforeunload = confirmExit;
  function confirmExit(){
      if(readCookie("onlineVD") == "playing" &amp;&amp; Confirm_Delete=="0")
      {
          return "You are leaving a video which is in play mode.Are you sure want to exit this page?";
      }
      else{
          Confirm_Delete="0";
      }
  }
  </code></pre>
  
  <p>I want window.close for on tab close and on window close in all browsers.</p>
  
  <p>Please find me a solution</p>