Making page change location after few seconds

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Making page change location after few seconds

Post by nigma »

Anyone know how to make a page change to another page(as if a link was clicked) after like displaying the page for 3 seconds? Like after you add a message it gives you two links, go back and view you message, and edit your message, if you don't click one it will automatically take you to your message.

Someone give me an example of how that is done?

Thanks for all help and advice provided.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

when you posted that message you had an example ;)
Within the doucment that told you "Your message has been successfully entered" there is a line

Code: Select all

<meta http-equiv="refresh" content="3;url=viewtopic.php?p=31715#31715">
in the header section, asking the browser to replace this document in 3 seconds by viewtopic.php?p=31715#31715
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Thanks a bunch! That worked perfectly.
Skyzyx
Forum Commoner
Posts: 42
Joined: Fri Feb 14, 2003 1:53 am
Location: San Jose, CA

Post by Skyzyx »

If you were using JavaScript, you do this:

Code: Select all

setTimeout("location.href='new.htm';", 3000);
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

You can even use PHP to do this:

header( "Refresh: 3; url=http://url.com " );
waskelton4
Forum Contributor
Posts: 132
Joined: Mon Sep 09, 2002 6:42 pm

Post by waskelton4 »

bringing back an old post here...

when using the header("Refresh....

is there any chance this will interfere with the page in any way?
or does it simply wait to perform what would be a header("location:url");?

thanks for the help..

glad i found this one..

Will
Post Reply