By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Logging Off

P: n/a
Hello, Can anoyone help me with the following:

I have a application online using ASP in which users log in and log out.
However, a lot of users simply close the window, bypassing my log-out
script. I have tried using the Javascript onUnload function with success,but
refreshing the screen also triggers this at the wrong time, Has anyone got
any suggestions?

Thanks in advance,

Gram
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Create a frame structure and put the unLoad listener on the window that
contains the frames (the top window). That way the frame containing your app
can change URLs willy nilly, but the unLoad event with your log off routine
won't happen until the top window is unloaded.

Mike

"Gram" <gr******@hotmail.com> wrote in message
news:vo**************@news.indigo.ie...
Hello, Can anoyone help me with the following:

I have a application online using ASP in which users log in and log out.
However, a lot of users simply close the window, bypassing my log-out
script. I have tried using the Javascript onUnload function with success,but refreshing the screen also triggers this at the wrong time, Has anyone got
any suggestions?

Thanks in advance,

Gram

Jul 20 '05 #2

P: n/a
Mike wrote on 10 Dec 2003 at Wed, 10 Dec 2003 16:56:26 GMT:
Create a frame structure and put the unLoad listener on the
window that contains the frames (the top window). That way the
frame containing your app can change URLs willy nilly, but the
unLoad event with your log off routine won't happen until the
top window is unloaded.


What if my browser crashes? What if I disconnect before logging off?
What if my browser doesn't execute onunload events[1]?

Important actions should be carried out as soon as the user does
something that makes those actions necessary. For example, if you are
recording preferences that are in-line, rather than on a separate
page, and the user changes an option, that preference should be
recorded immediately.

The logging off process should be able to occur in two ways: when the
user clicks a 'Log Out' link or button, or after a certain period of
inactivity. Both should do the same things, but only the former
should require user interaction or presence.

Mike

The only thing you can guarantee is that user's don't follow
instructions.
[1] When I was trying to record preferences with onunload (before I
took the advice above), I found that Opera didn't do anything, while
IE did. I tried putting window.open() calls, alert boxes, page
changes, and cookie creation statements into the event, one at a
time, but none of them worked. I assume then, that Opera doesn't
support onunload.

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #3

P: n/a
"Gram" <gr******@hotmail.com> writes:
I have a application online using ASP in which users log in and log out.
However, a lot of users simply close the window, bypassing my log-out
script.
A very common problem, and there is no safe solution. Remember, the
user might not even be connected to the internet, when he closes the
browser. With that in mind, you might as well change your session
design to using a timeout.
I have tried using the Javascript onUnload function with success,but
refreshing the screen also triggers this at the wrong time, Has anyone got
any suggestions?


Instead of sending a logout command with the onunload handler, send a
"log me out in 20 seconds unless you hear from me again" command. If
the page is refreshed, you know you can ignore it. Otherwise you can
log him out after 20 seconds. Pick a time that is not too short, based
on the normal behavior of yuor users.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.