homepage Welcome to WebmasterWorld Guest from 54.198.148.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
OnUnload event hadler during browser refresh
EReynolds




msg:590148
 2:49 pm on Feb 18, 2001 (gmt 0)

Hello
I have a client that wants a popup window
to load when a user leaves a certain page.

*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

 

tedster




msg:590149
 9:21 pm on Feb 18, 2001 (gmt 0)

Hello EReynolds, and welcome to WebmasterWorld.

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.

Jabbotts




msg:590150
 10:51 am on Apr 11, 2001 (gmt 0)

I have a similar situation. The only difference is that I don't mind if the browser refresh triggers the OnUnload.
I want to be informed of internal server errors, so I'd like to submit the contents of a form on my Error 500 page to Matt Wright's formmail script whenever the user leaves. It should be up to the user if he fills the form out (comments, etc.) Even if blank, however, I would at least be notified of a problem.

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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved