Discussion » Redirecting Javascript

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by beargod, 15:05, 4th September 2003:
 
I know the code to redirect using javascript, but is there a way to redirect after like 5 seconds using just javascript?
Posted by Grim..., 15:11, 4th September 2003:
 
Yes.

<meta HTTP-EQUIV=REFRESH CONTENT="1; URL=index.php">


Where "index.php" is the page you want to head to, and "1" is the number of seconds.
Posted by beargod, 15:34, 4th September 2003:
 
cheers dude, I knew it had to be resonably easier
Posted by Grim..., 15:42, 4th September 2003:
 
Easier than what?
Posted by beargod, 15:58, 4th September 2003:
 
I meant easy, but its easier then what I thought it would be
Posted by cal, 17:26, 4th September 2003:
 
and if you want to use j-a-v-a-s-c-r-i-p-t:

<script language="Javascript">
<!--

window.setTimeout("window.location.href = 'new_page.htm';", 5000);

-->
<script>
Posted by Grim..., 08:43, 5th September 2003:
 
Um, I think he said that he knew how to do that... It depends on which bit of his post you assume is correct...
Posted by cal, 09:36, 5th September 2003:
 
it was the "after 5 seconds" bit i was answering. i think that's what he was asking for specifically. hard to tell :)
Posted by beargod, 09:39, 5th September 2003:
 
Yes that is what I was going for the timing bit, I new the javascript code to redirect, but I needed the timer which I did not know, but the meta tag did fine anyway

Cheers guys :)