View Full Version : html type "refresh" using javascript
tomhilton
02-23-2003, 08:10 PM
Hi, I know just about nothing about javascript, but am looking for a way to send a user back a couple pages after a five-second interval.
In html i use the meta "refresh" tag, but in this case, I need to send them back to their origin, which I dont know. How can I use the history.go(-2) method to send someone back, using a meta refresh style script?
Any ideas or help would be greatly appreciated.
pardicity3
02-23-2003, 08:21 PM
So are you looking for a way to delay the script from running for a little bit of time? If that is what you are looking for, look into the settimeout() and setinterval() functions.
joh6nn
02-23-2003, 08:25 PM
i'm pretty sure the only way you can do that is with javascript
tomhilton
02-23-2003, 09:18 PM
Yes, I want to display the results of a pages' output for about 5 seconds before taking individual back to the page they were visiting from. I can use the refresh property of html to hold the output for the five seconds, but html doesnt have any functions that tell you where the visitor came from, so I cant use html to send them back. I know javascript has the history.back() and history.go() methods, just don't know how to invoke them as part of the settimeout method. Any ideas?
redhead
02-23-2003, 09:31 PM
this should work:
<script type="text/javascript">
window.setTimeout("history.back(2)", 5000);
</script>
tomhilton
02-23-2003, 10:51 PM
Hey!
Thanks so much! Your setTimeout script worked. I tried it with the history.back(2), and it took me back one page to the input form, then I tried history.go(-2) and it took me back two pages, to the originating website.
This is great. Appreciate your help.
redhead
02-24-2003, 08:55 AM
anytime...
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.