Click to See Complete Forum and Search --> : Automatic refresh in a frame


bioS
02-18-2003, 04:18 AM
Hi !

I'm proud to present you my... first JavaScript lines... which drive me crazy ! :confused:

I have a page with two frames and I'd like to implement an automatic refresh in only one of them.
I put the following code in it, and it works fine.

But if change the code by adding the blue part, the refresh is done two times and then stops.

Any idea why this happens ?

Thanks a lot ! :)


<script language=\"JavaScript\">
<!--
var sURL = "http://www.myURL" or var sURL = "http://www.myURL#endPage"
function doLoad()
{
setTimeout( \"refresh()\", 5*1000 );
}
function refresh()
{
window.location.href = sURL;
}
//-->
</script>

<script language=\"JavaScript1.1\">
<!--
function refresh()
{
window.location.href = sURL;
window.location.replace(sURL);
}
//-->
</script>
<body onload="doLoad()">
...
<a name='endPage'>
</body>

khalidali63
02-18-2003, 08:40 AM
you can always just use this HTML and have the page refreshed instead of all htat mess you got there..:-)

<meta http-equiv="refresh" content="5">

put the above line above the title tag in the head sectionof the page.

cheers

Khalid

bioS
02-18-2003, 09:17 AM
As I answered in another Thread, this meta tag doesn't work well in frames. Actually, it is sometimes yes, sometimes not.

As I couldn't find the logic of this problem, I've tried to resolve it with JavaScript.

But as I said before, it's quite the same. With my browser (IE5.0), it works fine. But with some other ones (ie IE5.5), the refresh is made only a few times and then stop. :confused:

khalidali63
02-18-2003, 11:43 AM
Originally posted by bioS
........... this meta tag doesn't work well in frames. .
I'd be really surprised to find out that an HTML tag does not work in a frame.

Anyhow,
Here is a link take a look,just to see if I get any inconsitent results,I ran it for almost 30 mins continously without any problem.

http://68.145.35.86/skills/javascripts/frames/AutoRefreshFrames.html

cheers

Khalid

bioS
02-19-2003, 02:58 AM
Hi Khalid !

Thanks for your help.
It is true that your page runs well.

Actually, I just realized that the places I know where my script doesn't work are... behind proxies. And the changements on the page are made on the server side. This is maybe the critical point. The refresh maybe works, but only from the proxy.

Is there any tag to help it ?

merci,
nico