[RESOLVED]Handle browser close event in Jquery or Javascript


   I need to handle the browser close event or browser window close event in jquery or javascript

You cab try the body onunload event. But u don’t think that triggers when the user closes the browser or kills the browser process. 


Explain rather what you want to do (cleaning session or whatever ?). Stricly speaking a browser doesn’t have a close event. See


Unless you have a strong reason to do that, I would stay away of it. This is just how the web works and it’s likely better to work with it rather than against it.


Check this site for example code:


Leave a Reply