Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Redirect Script

  1. #1
    Join Date
    Mar 2006
    Location
    Nashville, TN
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default Redirect Script

    I have this script that needs to wait 2 min. & 4 secs. before redirecting

    HTML Code:
    <html>
    <title>Redirect</title>
    <body onload=setTimeout("location.href='http://www.domian.com'",5) bgcolor="#FFFFFF">
    </body>
    </html>
    what does the number 5 go to?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It causes the script to wait five milliseconds (0.005 of a second) before redirecting.
    You should really use a meta refresh here, if you must use anything.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <title>Redirect</title>
        <meta http-equiv="refresh" content="124;url=http://www.domian.com">
      </head>
      <body onload="window.setTimeout(function(){location.href='http://www.domian.com';}, 1000 * (60 * 2 + 4)) style="background-color:white;color:black;">
        <p>
          Sorry, you should have been redirected to <a href="http://www.domian.com">http://www.domian.com</a>.
        </p>
      </body>
    </html>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Nashville, TN
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Ok mypage is not doing that. I'm trying to beat the flash before it redirects. Sugg.

  4. #4
    Join Date
    May 2006
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    The first time I saw "thekristo" I thought it was pretty cool... Still do actually! I wouldn't have it running non-stop though. Kinda gets to much the second/third time around.
    "Only dead fish flow with the stream".
    - Unknown

  5. #5
    Join Date
    Mar 2006
    Location
    Nashville, TN
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Ok well I still can have it redirect to another page, just need help.

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Oh...

    2min and 4sec...

    HTML Code:
    <html>
    <head>
    <title>Redirect</title>
    <script>
    function redirect(url,min,sec) {
    
    setTimeout("window.location = url",min*60*1000+(sec*1000))
    
    }
    </script>
    </head>
    <body onload="redirect('http://www.domain.com',2,4)" bgcolor="#FFFFFF">
    Redirecting...
    </body>
    </html>
    Ooops... My Bad
    Deleted the last post
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  7. #7
    Join Date
    Mar 2006
    Location
    Nashville, TN
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Twey posted this:

    <meta http-equiv="refresh" content="124;url=http://www.domian.com">

    Put that in the head section, with whatever else you want on the page. That will do it.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Mar 2006
    Location
    Nashville, TN
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    So I changed 124 to 10 to test, that is the time right? If it is it dont work Try It.

    It redirects to entry.asp from the flash. i would make a page called entry.asp but My webserver wont allow asp.

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    1. Yes, that's time, in seconds.
    2. Nope... not working.
    3. in your source, it appears that you might be using xml, with self-closing tags: <link ... />... so... maybe the meta needs to be like <meta ... /> too? Aside from that, looks right. I'm not sure about the /> thing.
    4. just change the redirected url, then.
    5. If asp isn't allowed, then don't use asp... why are you trying to?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •