Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Reloading Page

  1. #1
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Reloading Page

    How do you direct a visiter to another page after a set amount of time? I've seen it somewhere, but I've forgotten. Its either JavaScript or a meta tag.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Well, something like the below will do:

    Code:
    <script type="text/javascript">
    setTimeout("window.location='http://google.com'", 3000)
    </script>
    The above will cause the user to be redirected to Google in 3 seconds (3000 miliseconds).

  3. #3
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok thanks!

  4. #4
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was also wondering, is there anything specific you have to enter in JavaScript to make something happen in a time measured in miliseconds? Cause in that script there isn't, but i don't know if that is a pre-made script or not. (as in, preset in the javascript language, like html code)

  5. #5
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmm not sure what you're asking, though setTimeout() is a prebuilt function of JavaScript that uses miliseconds as the units to wait before executing a code. So 3000 is 3000 miliseconds. Scroll to the bottom of this page for more info on the setTimeout function: http://www.javascriptkit.com/jsref/window.shtml

  6. #6
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!

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

    Default

    Meta tag's a better idea.
    <meta http-equiv="refresh" content="5;newpage.htm"/>
    in the head. 5 is the number of seconds to wait, newpage.htm is the page to go to. This is more reliable than Javascript.
    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!

  8. #8
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Hmm, I tried the META tag in IE 6, and it just keeps refreshing the page.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    HTML Code:
    <meta http-equiv="refresh" content="5;URL=newpage.htm">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Sep 2005
    Location
    Connecticut
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks! It works great now!

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
  •