Click to See Complete Forum and Search --> : Help!! Reload


zanghani
08-15-2003, 11:47 AM
I want a page to reload automatically to another page after waiting for 10 seconds. How do I use javascript to accomplish this?
I want this page to reload a page from history, using the history.back() function.

Thanks

Khalid Ali
08-15-2003, 12:08 PM
you can use setTimeout to set a timer say after 10 seconds and then in that just call this function
history.go(-1)
where -1 will be the last page in history

zanghani
08-15-2003, 02:39 PM
I tried the history.go(-1) function, but its brances back to an undefined page. Here's the code that I used. I'm not sure if its the correct way of writing it.

<script langauage="javascript">
setTimeout('location.href=history.go(-1)',1000*10);
</script>
This code is placed in the head of my page

zanghani
08-15-2003, 03:45 PM
Hey Khalid, thanks for your help. I got it to work by using the Refresh meta tag as follows:

<Meta HTTP-EQUIV="REFRESH" CONTENT="10;url='javascript:history.go(-1);'">

Thanks again.

By the way, do you know how I can display a timer on the page that decrement to let people know exactly how long before the page will reload?

Khalid Ali
08-15-2003, 05:18 PM
I have a counter like that at
this link (http://www.webapplikations.com/pages/server_redirect_page.html)

Make sure you get the source before the time is up... :D

Paul Jr
08-15-2003, 09:45 PM
How about an Auto Redirect to a completely different URL, with a count down.

Khalid Ali
08-15-2003, 09:58 PM
well if you are sking a question then the script I pointed to above you can use it.
just point it to a new location
windo.location.href = "urlocation.html"

Paul Jr
08-15-2003, 11:55 PM
To which Script are you refering?

zanghani
08-18-2003, 03:20 PM
Khalid, thanks man, you're awesome.