Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stop loading current page

Status
Not open for further replies.

neonep

Programmer
Jun 26, 2003
34
Hi everyone,

I have a div on a page that I display as a popup ( it's NOT an external popup, just something inside the page that is shown or hidden as a popup ) when a button is clicked. I need to display the same div when a person tries exiting the page. Let's say someone types a new URL and hits enter on the browser address bar, I display the div using onBeforeUnload property but the page keeps on loading and the user is redirected to the new URL. I need to stop the browser from loading the URL until they click a button on the popup. Is there anyway I can do this?

I tried window.stop() in firefox but it doesn't stop the load and the reason seems to be as described at "Because of the order in which scripts are loaded, the stop() method cannot stop the document in which it is contained from loading, but it will stop the loading of large images, new windows, and other objects whose loading is deferred."

Any suggestions would be greatly appreciated.

Thank You in advance.
 
I tried using a setTimeOut which doesn't work either. The only thing that really works is if I put an alert() message up when they hit enter on the address bar. An alert will stay there until they press "ok" and will also NOT navigate away.

I would still like it to work with the div popup though.
 
You can use a confirm() - but again, it puts up a browser dialog (not your custom div popup).

I don't think you have any other choice!

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
There is no Firefox, Mozilla, Safari, Netscape or Camino equivalent to this function.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Hi

Well, neither Opera. And I can not test it now, but I am sure that neither Konqueror. And I am happy for that. Just like I am happy they did not implemented the possibilities for removing any/all bar or opening pages in full screen.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top