alexk Posted February 23, 2003 Posted February 23, 2003 (edited) How can i know when user close the browser. Not refresh page, not submit or repost - Close Browser ONLY. Thanks. Edited February 24, 2003 by alexk Quote
*Gurus* Derek Stone Posted February 24, 2003 *Gurus* Posted February 24, 2003 Before I give you a snippet of JavaScript that is often associated with advertisement popups, I have to ask, why? Why would you want to detect such an event? Quote Posting Guidelines
alexk Posted February 24, 2003 Author Posted February 24, 2003 (edited) Response to your question. My ASPX application provide interface that allow to users select any Item from table and change his properties. For example: Table contain office workers of my firm. User can select any worker from the list and change his properties. To prevent from another User select the same worker - I'm keep this worker locked for current User by using "http session ID". When User close the Internet Browser, I can NOT destruct session object and unlock a worker because it is NO *** event fired. Sorry about my English. [edit]Please watch your language [/edit] Edited February 24, 2003 by Robby Quote
bungpeng Posted February 26, 2003 Posted February 26, 2003 In VBScript, you can use this <SCRIPT LANGUAGE='VBScript'> Sub Window_onUnload msgbox "Unload" End Sub </SCRIPT> But you cannot control the browser to remain open. Quote
alexk Posted February 26, 2003 Author Posted February 26, 2003 Response to your note. I try code from above Post. The UnLoad event fired when I refresh or PostBack the page. It's not meet my requirement. I need capture Browser closing event ONLY. Thanks. Quote
bungpeng Posted February 26, 2003 Posted February 26, 2003 For your case, I suggest you use "Cookies" rather than "http session". And Cookies will destroy by itself when user close the browser (do not set expires date). So you no need to worry about the browser close event. Is it meet your requirement? Quote
*Gurus* Derek Stone Posted February 27, 2003 *Gurus* Posted February 27, 2003 Session cookies destroy themselves when the browser is closed. There is no need to detect the browser's termination. Simply requery the cookie on each request to ensure that the user is in fact authenticated. Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.