Closed Thread Icon

Topic awaiting preservation: How to reload a page but only once Pages that link to <a href="https://ozoneasylum.com/backlink?for=8631" title="Pages that link to Topic awaiting preservation: How to reload a page but only once" rel="nofollow" >Topic awaiting preservation: How to reload a page but only once\

 
Author Thread
zinedinew
Obsessive-Compulsive (I) Inmate

From:
Insane since: May 2003

posted posted 05-01-2003 14:28


Is there a way to reload a page only once and then stop loading?

Archonian
Nervous Wreck (II) Inmate

From: Sweden, Malmoe
Insane since: Jan 2003

posted posted 05-01-2003 16:47

You could have a 0 or 1 pixel frame at the top of your page, in that file for that top frame you could have a variable switching to true if the bottom frame has been reloaded, and then you make a check whether it's true or not. The bottom frame will be the page that you need to reload.

I think this will work:

In top frame:
var loaded = false;

In the bottom frame:
if (parent.frame[0].loaded==false) {
parent.frame[0].loaded = true;
parent.frame[1].location.reload();
}

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 05-01-2003 22:34

Yes, that would work but adding a frame just for that would suck IMHO -- especially if you wanted to keep the site XHTML compliant and all.

What I'd prefer to do is reload the page still using the location object but not using the reload() method. Instead point it back to the same html page like so:

document.location = "thisPage.html" // <- is a relative URL

But to stop this from happening each time the page loads add a search to the end and check for it before you re-load the page like dis:

if (document.location.search != "reloaded") {
document.location = "thisPage.html?reloaded"
}


I'm not really sure if you need to put document before location as I don't know if the location object belongs to the document object or the window object. I've never had any problems leaving the "document" part out and many of the texts I've read through say you can access the location object through self.location, much like the properties of the windows object but eh, like I said I've never really found any problems using document.locaiton.... So if it doesn't work on some browser then just play around with that bit and all should be fine.

Edit:
Add this to the :FAQ:



[This message has been edited by Dracusis (edited 05-01-2003).]

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 05-02-2003 17:44

this came up a while ago, but I can't seem to find the threads


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

« BackwardsOnwards »

Show Forum Drop Down Menu