This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
only way to do it is IE only and that is the onbeforeunload event handler. There is not other way to capture the close, you have to realize that the back button, refresh button, links, and closing the browser fire the same event, hence why it basically is impossible to determine what happened.