redirect

Discussion in 'JavaScript' started by dean5000v, Feb 16, 2009.

  1. #1
    hey im using this to redirect the user to a page within a conditional statment.

    <script>location.href='index.php'</script> ";

    but i wld like to add a timestamp so that it redirects after 5 seconds, can anyone help ?
     
    dean5000v, Feb 16, 2009 IP
  2. NoamBarz

    NoamBarz Active Member

    Messages:
    242
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #2
    function Redirect(){
    document.location.href='index.html';
    }

    <a href="javascript:setTimeout('Redirect()', 5000);"> click </a>
     
    NoamBarz, Feb 16, 2009 IP
  3. dean5000v

    dean5000v Peon

    Messages:
    201
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i didn't want it as a link, is there a way u can change it so does it automatically !
     
    dean5000v, Feb 16, 2009 IP
  4. NoamBarz

    NoamBarz Active Member

    Messages:
    242
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #4
    <body onload="javascript:setTimeout('Redirect()', 5000);">

    Just place it in the body tag
     
    NoamBarz, Feb 16, 2009 IP
  5. ranacseruet

    ranacseruet Peon

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    window.location = "url";
    Should work fine.......
     
    ranacseruet, Feb 16, 2009 IP