xProteuSx Posted October 6, 2011 Share Posted October 6, 2011 How can one re-direct a visitor, without using a header re-direct? I'd like a page to show up, then after about 5 seconds I need the visitor sent to another page. How can I do this? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 not sure why you don't want to use a header here.. however to simply answer your question.. <meta HTTP-EQUIV="REFRESH" content="5; url=http://www.yourdomain.com/index.html"> Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted October 6, 2011 Author Share Posted October 6, 2011 The reason that I don't want to use a header, is that I need the page to actually display for a few seconds before the redirect takes place. I've never heard of a time delay on a header redirect ... Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 what i gave you will keep you on the page for 5 seconds, then redirect using the meta tag to the specified URL Quote Link to comment Share on other sites More sharing options...
Andy-H Posted October 6, 2011 Share Posted October 6, 2011 header("refresh: 5; yourpage.php"); Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); without using the header funciton Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); without using the header funciton Yes, but the poster's reason was: The reason that I don't want to use a header, is that I need the page to actually display for a few seconds before the redirect takes place. I've never heard of a time delay on a header redirect ... So I showed the time delay. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); without using the header funciton Yes, but the poster's reason was: The reason that I don't want to use a header, is that I need the page to actually display for a few seconds before the redirect takes place. I've never heard of a time delay on a header redirect ... So I showed the time delay. lol.. very true my friend.. guess its one of those days.. Quote Link to comment Share on other sites More sharing options...
requinix Posted October 6, 2011 Share Posted October 6, 2011 header("refresh: 5; yourpage.php"); Refresh is not a standard HTTP header. There's no guarantee that'll work. sleep(5); header('Location: somewhere'); exit(); That won't work at all. The best solution posted yet, though there's also JavaScript to consider. window.setTimeout(function() { document.location = "http://www.yourdomain.com/index.html"; }, 5000); Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); That won't work at all. Really? How so? Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 6, 2011 Share Posted October 6, 2011 sleep(5); header('Location: somewhere'); exit(); That won't work at all. Really? How so? Well obviously it works as posted, but not with output before. My bad. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 7, 2011 Share Posted October 7, 2011 sleep(5); header('Location: somewhere'); exit(); That won't work at all. Really? How so? Well obviously it works as posted, but not with output before. My bad. yes abra this is why I questioned your post previously.. I am assuming that the OP has a good amount of code coming before this procedure and is confused on how to go about this.. then again for something like this.. the header can most likely, and probably should go at the top of the code.. since the OP will want to re-direct the visitor immediately Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted October 7, 2011 Share Posted October 7, 2011 <a href="/somepage.php">Click me in 5 seconds</a> Quote Link to comment Share on other sites More sharing options...
Andy-H Posted October 8, 2011 Share Posted October 8, 2011 <a href="/somepage.php">Click me in 5 seconds</a> lol Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted October 9, 2011 Share Posted October 9, 2011 <a href="/somepage.php">Click me in 5 seconds</a> most likely the best solution yet.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.