Disabling Page Refresh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Frantz

    Disabling Page Refresh

    I have a META tag coded as follows:

    <META HTTP-EQUIV="refresh"
    CONTENT="60;URL =http://www.mydomain.co m/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.getEle mentById("refre shMeta").httpEq uiv = 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.


  • Ivo

    #2
    Re: Disabling Page Refresh

    "Tom Frantz" wrote[color=blue]
    > I have a META tag coded as follows:
    >
    > <META HTTP-EQUIV="refresh"
    > CONTENT="60;URL =http://www.mydomain.co m/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[/color]
    page[color=blue]
    > from reloading itself so I created the following function:
    >
    > function disableRefresh( )
    > {
    > document.getEle mentById("refre shMeta").httpEq uiv = 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.[/color]

    I am not sure meta tags can take id's officially. But this idea might work:
    <script>
    var node = document.getEle mentsByTagName( 'meta')[x];
    node.parentNode .removeChild(no de);
    </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


    Comment

    Working...