Mil1243 Posted April 14, 2007 Share Posted April 14, 2007 Is there any code in PHP that shows a page for a specific time i.e 10 seconds and automaticlly redirect the page to the other URL ?! Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/ Share on other sites More sharing options...
Lumio Posted April 14, 2007 Share Posted April 14, 2007 no. You can only automatically redirect a page by header('Location: newpage.php'); Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229259 Share on other sites More sharing options...
HoTDaWg Posted April 14, 2007 Share Posted April 14, 2007 wouldnt javascript redirecting be easier? Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229261 Share on other sites More sharing options...
Glyde Posted April 14, 2007 Share Posted April 14, 2007 Or you can use HTML or JavaScript...examples below. HTML: <meta http-equiv="refresh" content="10;url=someurl.com" /> JavaScript: var timeLeft = 10; var redirectTo = "msn.com"; var timeInt = setInterval(checkTime, 1000); function checkTime() { timeLeft--; if (!timeLeft) { clearInterval(timeInt); window.location=redirectTo; } } That's about the simplest way. Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229263 Share on other sites More sharing options...
wildteen88 Posted April 14, 2007 Share Posted April 14, 2007 use header refresh: header("refresh:10; url=http://www.google.com"); What that will do is wait 10secounds then redirect the user to google. change goole's url to your url and place the code where you need it. However make sure there is no output when you call this function. Only send output after you have called it. Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229264 Share on other sites More sharing options...
Glyde Posted April 14, 2007 Share Posted April 14, 2007 use header refresh: header("refresh:10; url=http://www.google.com"); What that will do is wait 10secounds then redirect the user to google. change goole's url to your url and place the code where you need it. However make sure there is no output when you call this function. Only send output after you have called it. I didn't even know that refresh but still widely supported but hey, I guess it's the exact same thing as using <meta> to do it. Good call. Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229268 Share on other sites More sharing options...
Mil1243 Posted April 14, 2007 Author Share Posted April 14, 2007 thank u very much!!!! Quote Link to comment https://forums.phpfreaks.com/topic/47011-php-redirecting/#findComment-229453 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.