RaythMistwalker Posted November 9, 2011 Share Posted November 9, 2011 Ok I know I can redirect using: header( 'Location: URL' ) ; Now, is there a way to delay this after a short while of displaying or would I have to use Javascript? Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/ Share on other sites More sharing options...
floridaflatlander Posted November 9, 2011 Share Posted November 9, 2011 Or could you use <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.website.com"> 0 = seconds Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1286762 Share on other sites More sharing options...
xyph Posted November 9, 2011 Share Posted November 9, 2011 Client-side actions are the only way to delay a redirect while displaying content. You could use a sleep() in conjunction with a header() call, but I doubt this would have the effect you desire. JavaScript, or as floridaflatlander stated, meta tags, are your 'best' ways to accomplish this. Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1286764 Share on other sites More sharing options...
RaythMistwalker Posted November 9, 2011 Author Share Posted November 9, 2011 So say I wanted to run a shoutbox, would that code work for refreshing the text every 5/10 seconds? Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1286854 Share on other sites More sharing options...
xyph Posted November 9, 2011 Share Posted November 9, 2011 AJAX is probably something you'll want to read up on Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1286865 Share on other sites More sharing options...
kicken Posted November 10, 2011 Share Posted November 10, 2011 You can do a refresh header too: header('Refresh: 10; url=http://url/'); Pretty much the same as the meta tag. Latest IE, Chrome, and Firefox all support it. Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1286910 Share on other sites More sharing options...
KevinM1 Posted November 10, 2011 Share Posted November 10, 2011 If you only want to refresh/update some content on your page without having the entire thing reload, then AJAX is your only option. Quote Link to comment https://forums.phpfreaks.com/topic/250795-php-redirect/#findComment-1287033 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.