onUnload question

Results 1 to 2 of 2

Thread: onUnload question

  1. #1
    Join Date
    Dec 1969

    Default onUnload question

    Is there a way to only use the onUnload if the browser window closes? The user should not close the browser before logging out, but just in case they do I&#039;d like to log them out anyways by doing an onUnload...the only problem is I don&#039;t want it logging them out by leaving the current page and going to another page within the same area...<BR><BR>Any help is appreciated

  2. #2
    Join Date
    Dec 1969

    Default The only way I know of

    is to have a function tied to the onunload event that checks some other variable for true or false. Set this variable to false be default. On EVERY navigation path (be it an anchor or form) set the value to true. So in your function if this variable = false at unload time, then load some other page to "log them out".<BR><BR>Also, if by "logging them out" you mean either emptying out the session collection for that user, when they leave your pages, instead of waiting the default 20 minutes, there is no way to get around going back to the server. The browser is go8ing to have to communicate something to the server for it to know to do this.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts