Disabling Page Refresh

T

Tom Frantz

I have a META tag coded as follows:

<META HTTP-EQUIV="refresh"
CONTENT="60;URL=http://www.mydomain.com/myPage.html" id="refreshMeta">

This of course causes the page to automatically refresh itself every 60
seconds.

Now I want to have a button on my page that allows the user to stop the page
from reloading itself so I created the following function:

function disableRefresh()
{
document.getElementById("refreshMeta").httpEquiv = 0;
}

This all works fine when run locally on my machine, but it does not work
when run served by a remote server and I don't know why.

I'm running Windows 2000, Internet Explorer 6.0, and WebLogic 7.0 on the
remote server.
 
I

Ivo

I have a META tag coded as follows:

<META HTTP-EQUIV="refresh"
CONTENT="60;URL=http://www.mydomain.com/myPage.html" id="refreshMeta">

This of course causes the page to automatically refresh itself every 60
seconds.

Now I want to have a button on my page that allows the user to stop the page
from reloading itself so I created the following function:

function disableRefresh()
{
document.getElementById("refreshMeta").httpEquiv = 0;
}

This all works fine when run locally on my machine, but it does not work
when run served by a remote server and I don't know why.

I am not sure meta tags can take id's officially. But this idea might work:
<script>
var node = document.getElementsByTagName('meta')[x];
node.parentNode.removeChild(node);
</script>
where x is the zero-based index of the meta tag in question. So if it is the
second, x would be 1.
There are other ways, including refreshing the page using a script rather
than a meta tag and controlling whether this script runs or not with a
variable.
HTH
Ivo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top