Hi, What is the best way (sure shot way) to execute a function when a user closes a browser window using the X button of the browser. I'm using onUnload in the body tag but the event doesn't always fires. Thanks, Sanjeev