Welcome to WebmasterWorld Guest from 54.162.121.80
Forum Moderators: incrediBILL
*Yes, I know this is bad etiquette. That's
between him and his customers.*
I haven't used the onUnload handler before
and it seems to be invoked when I manually
refresh the browser. I may be picky, but
I don't like it.
Has anyone found a way to short-circuit
the handler if a user manually refreshes
the page?
Basically, I don't want it to happen.
Thank you very much
Eric Reynolds
Your question sent me digging through reference books and doing some online research, but the situation looks unresolvable to me because of two things --
1) a refresh always triggers an onUnload event
2) there's no way that JavaScript on one page can automatically find out what page will load next. That would introduce outrageous security problems.
One solution (that really isn't a solution at all) might be to first use the onUnload event to trigger a confirm box that asks if the visitor really intends to leave the page.
Of course, then you've popped up something anyway, but if you really want to save the pop-up information until a true page exit, at least this technique would do that.
Now I've only gotten the procedure to work upon a browser refresh, but unfortunately not on a normal unload like the back button or a manually typed URL.
Any suggestions?