wrote:
> Hi,
>
> I'm not sure if this question should go to the "JavaScript" section;
> but I'm open to non-JavaScript (like VBScript) options too. So, I'm
> posting this here.
>
> I have the following problem:
>
> For my application, I need to ask a confirmation when the user closes
> the browser-window. If the answer is positive, I would like to log-off
> the session and close the window. If the answer is negative, I would
> like to stay back (no logging-off, no closing the window).
>
> I can't do this in the window.unload event because the window is
> already closed when the unload event is fired. I tried doing this in
> the beforeUnload event. But the beforeUnload event gets called even
> when I refresh the page and in that case, I don't want to ask this
> question or logoff.
>
> Can somebody help me in the above scenario? Please...
>
Yes, I can help you...
I had exactly the same question here some months ago, and with the
help of a lot of the regulars in this group we came to a conclusion:
Forget it! It can't be done in any reliable way!
I'm sorry.
Your best bet is a session timeout on the serverside.
--
Dag.