Forum Moderators: open

Message Too Old, No Replies

How to execute some server side code onUnload

         

stankb

2:56 pm on Aug 8, 2002 (gmt 0)

10+ Year Member



Hello,

Is there a way to execute some server side code (servlet, asp, etc) when client closes the main browser window?

In IE we are opening a new window on onUnload event but that functionality is disabled in Netscape, Mozilla (at least for now), so I am trying to find a way to contact our server when a client leaves the browser and unlock some stuff for the user.

Thanks for any help,
Stan

RossWal

4:21 pm on Aug 8, 2002 (gmt 0)

10+ Year Member



I'm pretty sure not. The browser sends no http header to the server upon closing or leaving the site (as far as I know). You could possibly track user sessions server side, and after a certain period of inactivity take some action.

jatar_k

4:26 pm on Aug 8, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



stankb,

You are still going to run into the same problem. You need some kind of event to trigger it. You can call whatever you want onunload but if the event isn't triggered it won't work.

You could maybe have a cron job that does routine cleanup on some determined schedule. Have the server cleanup after the people that don't use IE. Just trying to think of some possibilities. If your IE usage stats are high enough this might be an option.