Fire a Function on window close
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3888902/javascript-detect-browser-close-tab-close-browser">javascript detect browser close tab/close browser</a>  </p>
</blockquote>



<p>I have a java script countdown timer on my page and i want to trigger an alert message if user tries to close the window or a tab. </p>
