Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Basic HTML problem

Back to Forum: Tech Off
  • User profile image
    Arowin

    Hi all,

    I'm sorry about the seemingly simple question, but I can't for the life of me (and three other people I've asked here at work) what the problem is....

    Here's my basic test HTML page (test.html):

    <html>
      <head>
        <meta http-equiv="Refresh" content="5;url=test.html">
          <script>
            var cur = 5;
            function start() {
              cur--;
              window.setTimeout("start();", 1000);
              document.getElementById("test").innerHTML = cur;
           }
          </script>
        </head>
        <body onload="start();"><span id="test"></span></body>
    </html>


    As you can see, it's got a basic countdown that gets displayed on the page and the page should refresh after 5 seconds (To another page - just in this case it's the same page).

    What my question has to with is the META tag.

    The refresh works fine in Firefox. I can see nothing wrong with the code, but the refresh does nothing when I try it in Internet Explorer...

    Is there something I'm doing wrong that's blatantly obvious? Is it just me? Smiley

  • User profile image
    Cannot​Resolve​Symbol

    Works fine here on IE6 and 7 Beta3.  Only thing I can think of is a security setting stopping it (Meta refresh is disabled if you have the zone's security setting set to high):

    Image Hosted by ImageShack.us

    My file used to test:

    Relative hyperlink in redirect:  MetaRefreshRelative.html

    Absolute hyperlink in redirect:  MetaRefresh.html

  • User profile image
    jmacdonagh

    By the way, if you aren't changing the URL when you refresh, you dont need the url= in the content attribute of the meta tag.

  • User profile image
    Matthew van Eerde

    Be aware that the HTTP Refresh header is non-standard.

  • User profile image
    phreaks

    Matthew van Eerde wrote:
    Be aware that the HTTP Refresh header is non-standard.


    You don't need META-Refresh in JS enabled Browsers.

    Not a web guy, so I dunno what the difference really is...
    If someone could enlighten me, well that would be peachy.

    <html>
      <head>
        <!-- meta http-equiv="Refresh" content="5;url=test.html" -->
          <script>
            var cur = 5;
            var URL = "test.html"
            function start() {
              cur--;
              window.setTimeout("start();", 1000);
              document.getElementById("test").innerHTML = cur;
              if(cur == 0) {
               window.location.href = URL;
              }
           }
          </script>
        </head>
        <body onload="start();"><span id="test"></span></body>
    </html>

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.