homepage Welcome to WebmasterWorld Guest from 54.198.42.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Auto redirect
Auto redirect after 10 seconds
Adam5000




msg:4391563
 3:05 am on Nov 28, 2011 (gmt 0)

Greetings all.

I'm working on a holiday update for my website and I've got an idea that involves redirection.

I'm trying to write PHP code that will automatically redirect a visitor from page one to page two after say ten seconds.

Help!

 

Leosghost




msg:4391571
 4:14 am on Nov 28, 2011 (gmt 0)

Search for "meta refresh" ( you don't need to use PHP to do what you want..there are various other ways )..HTH :)

penders




msg:4391620
 11:45 am on Nov 28, 2011 (gmt 0)

Or... JavaScript timer event to change the location.href?

You could use PHP to write out the meta refresh (or the JavaScript) but PHP itself cannot do this.

If you use JavaScript you could perhaps allow the user to 'pause' the redirection if required?

omoutop




msg:4391676
 3:23 pm on Nov 28, 2011 (gmt 0)


sleep(10);
header("Location: page-two.htm");


As long as there is no output to screen, this should work.

If you want to redirect user after the page loads, then only javascript can provide you with a solution.

g1smd




msg:4391765
 7:51 pm on Nov 28, 2011 (gmt 0)

Keep-alive may not keep the connection open for that long.

Your redirect also returns a 302 status.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved