HTML problems in IE but not in FF, need help

D0T-C0M

New member
I'm trying to get a page to refresh automatically using
Code:
<meta http-equiv=refresh content=5; url=wwwlive.html#lastline>

The refreshing works great in both browsers but I also want it to jump to the anchor that I have at the bottom of the page when it automatically refreshes. It works great in firefox but IE loads correctly and goes to the anchor but as soon as it refreshes, it reverts back to the top of the page.

Please any ideas. I would rather not use java if possible.
 
Last edited:

Thanks for the link unfortunately I cannot get java to work in IE nor firefox. It works somewhat with the following code but it only refreshed once upon loading the page than no longer refreshes. I need it to refresh every X amount of time continuously. Maybe the code I am using is not correct.

Code:
<script type="text/javascript">
function refreshme(){
window.location='http://mysite.com/~test/test001.html#lastline';
}
setTimeout("refreshme()",10000);
</script>

I'm using an anchor at the bottom of the page called lastline. every refresh I want it to go to the anchor
 
Thanks for the link unfortunately I cannot get java to work in IE nor firefox. It works somewhat with the following code but it only refreshed once upon loading the page than no longer refreshes. I need it to refresh every X amount of time continuously. Maybe the code I am using is not correct.

Code:
<script type="text/javascript">
function refreshme(){
window.location='http://mysite.com/~test/test001.html#lastline';
}
setTimeout("refreshme()",10000);
</script>

I'm using an anchor at the bottom of the page called lastline. every refresh I want it to go to the anchor

try

Code:
<body ... onLoad=javascript:"setTimeout('refreshme()',10000);">
blah blah blah
</body>
 
try

Code:
<body ... onLoad=javascript:"setTimeout('refreshme()',10000);">
blah blah blah
</body>

Thanks for you responses guys. Please excuse me seeker010 as I am not really java savvy, do I add your code in the <body> in addition with the code I pasted above in the <head> section? I ask because If that code is standalone code, how is it going to refresh AND jump to the anchor at the bottom of the page? I tried using it and it will not work for me.

I need a method of refreshing my webpage every X seconds && it also has to jump to the bottom of the page upon refreshing.
 
I've resorted to using java script to make the main page jump to a blank page that automatically jump back to the main page. It is the only way I've found of making it refresh and jump to the anchor at the bottom of the main page. Theres got to be a better way to do this but so far this is the only way I've found that works both in FF and IE.

If someone has another solution, please do tell
 
Last edited:
Try this. I think this is what you're looking for but not sure.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>refresh me</title>

<script language="JavaScript" type="text/javascript">
function PageRefresh() {
winloc="refresh.html#bottom"; //url
location.href=winloc;
}
setInterval("PageRefresh()",10000); //set page refresh time here
</script>

</head>

<body>
<div style="height:1500px;">
Page Top
</div>
<a name="bottom" id="bottom"></a>Page Bottom!
</body>
</html>
 
Try this. I think this is what you're looking for but not sure.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>refresh me</title>

<script language="JavaScript" type="text/javascript">
function PageRefresh() {
winloc="refresh.html#bottom"; //url
location.href=winloc;
}
setInterval("PageRefresh()",10000); //set page refresh time here
</script>

</head>

<body>
<div style="height:1500px;">
Page Top
</div>
<a name="bottom" id="bottom"></a>Page Bottom!
</body>
</html>

Hey thanks for your help so far. This script works except for one little problem. It refreshes and goes to the bottom of the page but when the page content changes, the changes aren't shown when the page refreshes automatically. Seems to be loading from cache. If I click on the refresh button the new content appears
 
try putting this in your header

<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">

edit: if that doesn't work, there is a javascript function called window.location.reload which I think can be used to do what you want. I'll look at it later when I have some time.
 
Last edited:
thanks alot , I tried those meta tags and it still won't upload the page. I tried changing the web page and the changes never showed even after many reset thereafter. I'll try to see what I can find in the meantime on that window.location.reload command too



Edit I read the following while researching how to implement the window.location.reload command...Maybe theres a reason it isnt working.

Internet Explorer has a couple non-standard extensions to the window object: window.showModalDialog() and window.showModelessDialog(), both of which create true dialog-type windows. These dialogs are much better suited than normal windows (as created by window.open()) for use in web applications.

Unfortunately, though, these dialogs have several annoying bugs and limitations:

* Window targeting is broken, so new opening URLs always opens new windows (even when a target window is explicitly set). Each of these actions is affected:
o Submitting forms
o Opening hyperlinks
o Programmatically using window.navigate(), window.location=url, window.location.assign(), window.location.reload(), window.location.replace()
 
Last edited:
I tried several different things, none of them worked correctly in IE. IE is a buggy piece of CRAP.

The best I got to work was a script that would always go to the bottom, it would not load the initial load normally. I'll try again later.
 
I tried several different things, none of them worked correctly in IE. IE is a buggy piece of CRAP.

The best I got to work was a script that would always go to the bottom, it would not load the initial load normally. I'll try again later.

Thanks for your help and time. I'm glad that I am not the only one with these results. Firefox works so well. I guess my workaround to jump to a temp html page and have it automatically redirect it back to the main page. This works but i get a momentary white page between refreshes but I guess will have to live with it.
 
Last edited:
Thanks for your help and time. I'm glad that I am not the only one with these results. Firefox works so well. I guess my workaround to jump to a temp html page and have it automatically redirect it back to the main page. This works but i get a momentary white page between refreshes but I guess will have to live with it.

I found something else that I tweaked a bit (well more than a little) You can check it out maybe it will suit your needs.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>refresh script</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        //alert("You have just wasted 10 seconds of your life.")
		window.location.reload();
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}



//Refresh page script- By Brett Taylor ([email protected])
//Modified by Dynamic Drive for NS4, NS6+
//Visit http://www.dynamicdrive.com for this script

//configure refresh interval (in seconds)
var countDownInterval=2;
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=200

</script>

<!--
<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>
-->

<script language="JavaScript" type="text/javascript">
var cycle=0;
var countDownTime=countDownInterval+1;
function countDuration(len)
{

}

function countDown()
{
	countDownTime--;
	if (countDownTime <=0)
	{
	countDownTime=countDownInterval;
	clearTimeout(counter)
	if (cycle >0)
	{
		//window.location.href=window.location.pathname+'?r=1#bottom';
	//} else {
		window.location=window.location.pathname+'?r=1#bottom';
		InitializeTimer();
		//window.location.reload()
	}
	return
	}

	if (document.all) //if IE 4+
		document.all.countDownText.innerText = countDownTime+" ";
	else if (document.getElementById) //else if NS6+
		document.getElementById("countDownText").innerHTML=countDownTime+" "
	else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
		document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
		document.c_reload.document.c_reload2.document.close()
		}
	counter=setTimeout("countDown()", 2); //set to zero so page never returns to top
}

function startit()
{
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
	document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds');
countDown();
cycle++;
}

if (document.all||document.getElementById)
	startit()
else
	window.onload=startit

</script>
<div style="height:2000px;">
top
</div>
<br />



<a name="bottom" id="bottom"></a>
bottom
<br />
<script language="JavaScript" type="text/javascript">
<!--
    // date to see something change
    document.write( (new Date).toLocaleString() );
//-->
</script>

</body>
</html>
 
javascript ftw

I know what you are going through though. I code all day and use Firefox to check my stuff. It's extensions make it the perfect web developer's browser.

After I get done coding and testing on Firefox, I then fire it up in IE and watch it break. Then I hack the IE fixes into it and restest on Firefox. I would say IE presents about 50% of all the annoying problems dealt with in any given day.
 
Last edited:
skynet that seems to works rather well. Thanks so much for your time. I really appreciate it. Just one last little thing, how do I remove the text "Next refresh in X seconds" I tried deleting that from the script but everytime I got it to go away the page stopped refreshing. Also that little countdown in the status bar in IE, can I get that in FF too?
 
skynet that seems to works rather well. Thanks so much for your time. I really appreciate it. Just one last little thing, how do I remove the text "Next refresh in X seconds" I tried deleting that from the script but everytime I got it to go away the page stopped refreshing. Also that little countdown in the status bar in IE, can I get that in FF too?

I dunno about the countdown timer in the status bar for Firefox, would have to look that one up.
EDIT: it does actually work, but you have to enable it in Firefox options. Go to Tools>Options>Content>Advanced and enable change status bar text

To remove the timer text replace this:
document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds');

with this:
document.write('<a name="countDownText" id="countDownText"></a>');

EDIT: Thats ALL wrong, didn't work correctly in IE. Here's the whole thing, hopfully fixed.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>refresh script</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        //alert("You have just wasted 10 seconds of your life.")
		window.location.reload();
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}



//Refresh page script- By Brett Taylor ([email protected])
//Modified by Dynamic Drive for NS4, NS6+
//Visit http://www.dynamicdrive.com for this script

//configure refresh interval (in seconds)
var countDownInterval=2;
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=200

</script>

<!--
<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>
-->

<script language="JavaScript" type="text/javascript">
var cycle=0;
var countDownTime=countDownInterval+1;
function countDuration(len)
{

}

function countDown()
{
	countDownTime--;
	if (countDownTime <=0)
	{
	countDownTime=countDownInterval;
	clearTimeout(counter)
	if (cycle >0)
	{
		//window.location.href=window.location.pathname+'?r=1#bottom';
	//} else {
		window.location=window.location.pathname+'?r=1#bottom';
		InitializeTimer();
		//window.location.reload()
	}
	return
	}

	if (document.all) //if IE 4+
		document.all.countDownText;
	else if (document.getElementById) //else if NS6+
		document.getElementById("countDownText")
	else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
		document.c_reload.document.c_reload2.document.write('<a name="countDownText" id="countDownText"></a>')
		document.c_reload.document.c_reload2.document.close()
		}
	counter=setTimeout("countDown()", 2); //set to zero so page never returns to top
}

function startit()
{
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
	document.write('<a name="countDownText" id="countDownText"></a>');
countDown();
cycle++;
}

if (document.all||document.getElementById)
	startit()
else
	window.onload=startit

</script>
<div style="height:2000px;"></div>
<br />



<a name="bottom" id="bottom"></a>
bottom
<br />
<script language="JavaScript" type="text/javascript">
<!--
    // date to see something change
    document.write( (new Date).toLocaleString() );
//-->
</script>

</body>
</html>
 
Last edited:
Back
Top