codrgii Posted March 8, 2010 Share Posted March 8, 2010 Is there anyway that a php script can redirect to somewhere 5 seconds after the page was excuted other than using META? Link to comment https://forums.phpfreaks.com/topic/194525-redirecting-a-page-other-than-using-meta/ Share on other sites More sharing options...
aeroswat Posted March 8, 2010 Share Posted March 8, 2010 Is there anyway that a php script can redirect to somewhere 5 seconds after the page was excuted other than using META? look into the header function and the sleep function Link to comment https://forums.phpfreaks.com/topic/194525-redirecting-a-page-other-than-using-meta/#findComment-1023104 Share on other sites More sharing options...
Anti-Moronic Posted March 8, 2010 Share Posted March 8, 2010 If you mean 5 seconds after the page is displayed in the browser - yes, but it can't be done with php alone. There 2 other ways: javascript and ajax. But if you use javascript, there's no point in using ajax to interface with php. SO, javascript lol http://codesnippets.joyent.com/posts/show/123 Hope that helps. You can't do this with php because the php script is run BEFORE the html output - so only ajax could bridge that gap. To explain better, say you want to redirect 5 seconds after a form is submitted using php - all the user will see is a redirect after 5 seconds. There will be no output during that time and you can't produce a 'this will redirect in 5 seconds' then have php redirect. That's why you'd have to use javascript or ajax. Link to comment https://forums.phpfreaks.com/topic/194525-redirecting-a-page-other-than-using-meta/#findComment-1023124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.