title: Close browser/Exit from website Events
body: <p>Nowadays I am creating browser game, using ASPX, CSS and AJAX.
  I need to know when the user close the browser or exit from website,
  because of these cases for example:</p>
  
  <ol>
  <li><p>if a player opens a game room and than close the browser or exit from the website,
  this room need to be deleted immediately. </p></li>
  <li><p>2 players are playing in a room, and than one of them leave so the game is finished and the one that stay is the winner. 
  In this case I can use the countdown timer of the players' turns, and when the countdown timer reaches 0 - The other player wins,
  but I prefer that the message will appear as soon as the player left the room,
  its faster, and when the countdown reaches 0 there is 2 possibilities - the player left or the player didn't react in time.</p></li>
  </ol>
  
  <p>Anyone can tell me how can I know when the user close the browser or exit from my website?
  because as far as I know the Session object won't be effective since the Session_End method runs several minutes after the browser is close or the user is AFK,
  and I can't let the Session_End close the room for players that are AFK since they are waiting for more players to join, and I need to fire my events immediately.</p>
  
  <p>P.S: I found this method, I don't know if its works but I don't think it will fit my needs because I need the event to fire even when the user move from my site to another website.</p>
  
  <pre><code>Ext.EventManager.on(window, 'beforeunload', function() {
      alert('cross-exit tab click AND cross-exit browser click');
  });
  </code></pre>