1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto Redirect after 60 seconds

Discussion in 'HTML & JavaScript' started by Essence19, Feb 14, 2011.

  1. Essence19

    Essence19 BANNED BANNED

    Joined:
    Aug 10, 2010
    Messages:
    830
    Likes Received:
    352
    How do I get a page on my site to automatically redirect to another site after 60 seconds?when the user arrives on a page after 60 secs it will redirect to another page?
     
  2. squark

    squark Junior Member

    Joined:
    May 22, 2008
    Messages:
    156
    Likes Received:
    1,207
    Place this code right before your closing body tag. I just typed this without actually creating a test page... but this should work (assuming I don't have any typos).

    Code:
    <script type="text/javascript">
        setTimeout(function() { window.location = "YOUR REDIRECT LOCATION"; }, 60000);
    </script>
     
    Last edited: Feb 14, 2011
  3. dennismorris14

    dennismorris14 Junior Member

    Joined:
    Jul 2, 2010
    Messages:
    166
    Likes Received:
    175
    Location:
    WorldWideWeb
    Add this
    Code:
    <meta http-equiv="refresh" content="10;url=http://www.blackhatworld.com"/>
    between <head></head> tags
    See the content = "10; thing?
    Change the 10 to change the amount of seconds before your viewer will be redirected and url=http://www.blackhatworld.com <--- change the link to the link you want your visitors to redirect....
     
    Last edited: Feb 14, 2011
  4. squark

    squark Junior Member

    Joined:
    May 22, 2008
    Messages:
    156
    Likes Received:
    1,207
    :eek: Sometimes I just overthink things with javascript and web pages. Using a meta refresh like this is a better way to do the redirect. You don't have to worry about javascript being enabled and it's a more accepted way of doing the redirect. Much simpler.

    Use the meta refresh instead of my code above.
     
    • Thanks Thanks x 1
  5. Essence19

    Essence19 BANNED BANNED

    Joined:
    Aug 10, 2010
    Messages:
    830
    Likes Received:
    352
    thanks guys I actually figured it out like 2 seconds after posting this,Using the big G I found a meta refresh which is perfect,stupid me,u guys rock :)