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.
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.
Well, something like the below will do:
The above will cause the user to be redirected to Google in 3 seconds (3000 miliseconds).Code:<script type="text/javascript"> setTimeout("window.location='http://google.com'", 3000) </script>
Ok thanks!
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)
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
Thanks!
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.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Hmm, I tried the META tag in IE 6, and it just keeps refreshing the page.
HTML Code:<meta http-equiv="refresh" content="5;URL=newpage.htm">
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thanks! It works great now!![]()
Bookmarks