Welcome to WebmasterWorld Guest from 54.226.146.15

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Auto redirect

Auto redirect after 10 seconds

     

Adam5000

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

10+ Year Member



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

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

WebmasterWorld Senior Member leosghost is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

penders

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

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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

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

WebmasterWorld Senior Member 10+ Year Member




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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

Your redirect also returns a 302 status.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month