PDA

View Full Version : Reloading Page



Wizard13335
10-10-2005, 05:41 AM
How do you direct a visiter to another page after a set amount of time? I've seen it somewhere, but I've forgotten. Its either JavaScript or a meta tag.

ddadmin
10-10-2005, 10:19 PM
Well, something like the below will do:


<script type="text/javascript">
setTimeout("window.location='http://google.com'", 3000)
</script>

The above will cause the user to be redirected to Google in 3 seconds (3000 miliseconds).

Wizard13335
10-12-2005, 02:02 AM
Ok thanks!

Wizard13335
10-12-2005, 02:03 AM
I was also wondering, is there anything specific you have to enter in JavaScript to make something happen in a time measured in miliseconds? Cause in that script there isn't, but i don't know if that is a pre-made script or not. (as in, preset in the javascript language, like html code)

ddadmin
10-12-2005, 09:55 AM
Hmm not sure what you're asking, though setTimeout() is a prebuilt function of JavaScript that uses miliseconds as the units to wait before executing a code. So 3000 is 3000 miliseconds. Scroll to the bottom of this page for more info on the setTimeout function: http://www.javascriptkit.com/jsref/window.shtml

Wizard13335
10-16-2005, 02:14 PM
Thanks!

Twey
10-16-2005, 02:33 PM
Meta tag's a better idea.
<meta http-equiv="refresh" content="5;newpage.htm"/>
in the head. 5 is the number of seconds to wait, newpage.htm is the page to go to. This is more reliable than Javascript.

Wizard13335
12-08-2005, 08:44 PM
Hmm, I tried the META tag in IE 6, and it just keeps refreshing the page.

jscheuer1
12-08-2005, 09:40 PM
<meta http-equiv="refresh" content="5;URL=newpage.htm">

Wizard13335
12-09-2005, 02:20 AM
Thanks! It works great now! :D

Twey
12-09-2005, 01:51 PM
Whoops!