Home > ASP Development > Detect Browser closure

Detect Browser closure



Hi,



I am using sessions in my program.



How is it possible to detect if a user is closing the browser window? If the browser window is closed i want to end the session.



Given that the user doesn't log out as they are supposed to.



The problem is, that if a user closes the browser and opens it up again before the session expiry time, they can log back in.



I would like to prevent this



I have seen this done on an Internet banking site but i don't know if it was through asp.



Does anyone know how?

    
Guest


Two solutions available:

on BodyUnload call javascript function..

1.That function will pass value to your page which will set clear session.

value might be passed by XMLHTTP request.

2. Or. in this function open a small popupwindow showing ad or something...In this window clear session and close this window by self.close.



Would happy to know other options.

If you find other option than this..Please append to this.

Was this answer helpful ? Yes No   
Guest


Why do you think this doesn't work very wel?

Was this answer helpful ? Yes No   
Guest


Using the Unload event to create a popup is the better option.

This permits the parent window to behave as per the user's wishes. For example, if they don't close the browser window, but simply go to another site, you don't want to override this action by going to your site instead. The popup can do what you want without causing interference.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved