How to show alert message when closing a window?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/333665/javascript-to-get-an-alert-when-closing-the-browser-window">Javascript To Get An Alert When Closing The Browser Window</a>  </p>
</blockquote>



<p>I want to show an alert message "Please logout before closing the window" with an logout button, when an user tries to close the window and after clicking on logout button the window can be closed. How to achieve this?</p>
