[RESOLVED]Handle browser close event in Jquery or Javascript

Hi

   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. 

Hi,

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

http://www.codeproject.com/Articles/58835/Window-Close-Event-of-Browser

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.

Hi,

Check this site for example code:

http://www.w3schools.com/jsref/event_onunload.asp

Leave a Reply