| Author |
stopping page by onUnload handler
|
Anurag Mishra
Ranch Hand
Joined: Jun 16, 2003
Posts: 121
|
|
Hi all, I have a question whe a user tries to go to a different page I am checking for some condition and if condition is true I am allowing him to move to next page otherwise same page will be displayed. This i m doing in onUnload handler, but if condition is false i want to stop unloading of current page . How do do this?? i tried window.stop(); and document.execCommand('stop'); but it did't worked. thanks for ur time. Anurag
|
SCJP 1.2
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
You might want to try document.location.href="theUrl" I do no think it will work
|
 |
Anurag Mishra
Ranch Hand
Joined: Jun 16, 2003
Posts: 121
|
|
Hi Eric, Its not what i m looking I just want a way to stop loading a page one i call onunload eventhandler. If you get time pls reply. thanks Anurag
|
 |
Yuriy Fuksenko
Ranch Hand
Joined: Feb 02, 2001
Posts: 411
|
|
You can do it on IE only using onbeforeunload handler. There is no way to do it using onunload. Best you can do, is to call alert, so the page will stay until user hits "OK".
|
 |
Anurag Mishra
Ranch Hand
Joined: Jun 16, 2003
Posts: 121
|
|
Hi Yuri, thanks a lot for your reply but onbeforeunload displays its own message I know we can customize this message but we cannot customize it totally as if we use this we need to display Microsoft's messages also. pls put your comments. thanks anurag
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
you are stuck with what you got, I would use a different approach where you send the links to a function and check it that way. If it is true then let them advance by changing the link This wil not stop yping into the Addy bar or closing the browser or the forward buttons Eric
|
 |
Jeramie Maratas
Greenhorn
Joined: Mar 16, 2004
Posts: 13
|
|
Hi.. I want to do the same thing: invoke the stop method of the web browser. If you were able to solve your problem, can you give me an idea on how to go about it? Thanks and more power. Best Regards, Jen
|
Best Regards,
Jen
|
 |
 |
|
|
subject: stopping page by onUnload handler
|
|
|