This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I want to catch the browser close button action. Let me explain the scenario first. When a user clicks on the close button of a browser, I want to send an ajax call to set his loginStatus to false in the database. I can do it with the js event of onbeforeunload, but that has too many problems. The biggest being, when I navigate to some other site say google.com, it will set the login status to false, but then when I click on the back button, the session should remain there (ideally), but its logged out.