<html>
  <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

  </head>
  <body>
    <h1>Eureka!</h1>
      <a href="http://www.google.com">Google</a>
      <a href="http://www.yahoo.com">Yahoo</a>
      <a href="http://ykyuen.wordpress.com">Eureka!</a>
  </body>
</html>

<script language="JavaScript">
/*  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
	alert("blabla");
  }*/
</script>


<script>

//http://www.codexworld.com/how-to-guides/how-to-detect-browser-or-tab-close-event-using-javascript/

	window.onbeforeunload = function()
	{
    //Ajax request to update the database
    $.ajax({
        type: "POST",
        url: "update_user_status.php"
    });
}
</script>