View Full Version : Reload iframe content

12-27-2005, 02:42 AM

I want to refresh the content of html page and (at the same time) refresh the content of an iframe that is on that page. I want this all to happen just by clicking the refresh button in my browser navigation bar. How should I do it? I have been looking at Javascripts and <body onload...>scripts but I can't seem to find any script or code that does the trick.

Here a bit more explanation:

I have an html page (page.html) with an iframe (iframe) in it.
In that iframe I show another html page (iframe1.html) that has an image with a hyperlink on it.
The hyperlink image refers to a third html page (iframe2.html).

When I open the page.html in my browser for the first time, all goes well. I can see the picture and click on it. After clicking the hyperlink image the iframe shows the iframe2.html page, just like it should.

However, when I refresh the page.html in my browser, the iframe keeps showing ifram2.html instead or returning to iframe1.html. What I would like to find is a script to reload the iframe content upon reloeading my page.html.

I have been searching Google for hours to find a solution. I feel that what I am looking for shouldn't be very complex, but maybe I am just looking in all the wrong places? I very much hope that one of you can help me out! Thanks so much in advance!

DoDo - :confused:

12-27-2005, 07:05 AM
Got link? It should load the first page that was in the iframe. Sounds like a caching issue on your end.

12-27-2005, 12:54 PM

It's a page on which I am experimenting a bit with publishing a video or audio file. Here's the link:
www.ruter.nl/play_av.html (http://www.ruter.nl/play_av.html).

If it's a caching problem, won't more people have the same problem if they view my page? Is it possible to overrule this?


12-28-2005, 01:31 PM
Server-side would be the easiest way of dealing with this - prevent those pages from being cached as you serve them.

But if that's not possible, try a function tied to the load event of the parent page, that sets the SRC of the iframe page, but with the addition of a random number in query-string data appended to the address. That random number will ensure the URL is always unique, and hence, you never get a cached response.