Forum Moderators: open

Message Too Old, No Replies

Stopping Meta Refresh using Javascript

Help with Javascript to Stopping Meta Refresh

         

enjoysolutions

5:06 pm on Mar 26, 2006 (gmt 0)



I have the following in the <head> section:

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

This is there as a backup incase the users browser doesn't support my Ajax methos to refesh the content on a section of the page.

I have been trying to stop the meta refresh from happening using Javascript, does anyone have any suggestion on how to do this?

I have tried the Removechild method, but this seemed to not work

Cheers,
Mark

Dijkgraaf

10:02 pm on Mar 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it those browser that have JavaScript disabled the ones you are trying to do the refresh for?

If so you could put this in the header, the trick here is that I've put the Refresh in the noscript.

<script type="text/javascript">
<!--
your code here
//-->
</script>
<noscript>
<meta http-equiv="Refresh" content="5">
</noscript>

The other thing to try is maybe the oposite of RemoveChild, and try adding it instead.

Dijkgraaf

11:49 pm on Mar 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A third option is to set a timer and having the function that the timer calls checking to see if the page needs to be refreshed or not.

DrDoc

5:24 am on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Timer and adding child will not work, as the purpose of the meta refresh is for those who have JavaScript turn off.

Dijkgraaf

6:21 am on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thats what the first option was for DrDoc.

It was a bit unclear from the original question whether he was aiming for browser without JavaScript, or that with JavaScript he was detecting that they weren't capable of using the methods required for AJAX. Hence I gave multiple solutions :-)

You could even mix the noscript and the timer to cover both scenarios.