File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Refresh times to be one Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Refresh times to be one" Watch "Refresh times to be one" New topic

Refresh times to be one

Sophia Choi
Ranch Hand

Joined: Mar 22, 2002
Posts: 106
In HTML, I can refresh a page every 0.5 seconds.
<META http-equiv="REFRESH" Content="0.5">
How can I control the refresh times of a page to be once ?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

If what you are trying to achieve is to cause the page to refresh itself just once a certain period of time after the page is initially loaded, you can create an onLoad handler (that will execute when the page loads) which will use the setTimeout() function to cause another function to execute after your duration has expired. This function would reload the page.
Problem is, of course, that your reloaded page will try to do the same thing unless you find a way to tell it not to. You could set and check a cookie (cause the refresh if not set, skip it if so), or (my choice) use a request parameter on your reload that tells the second reload not to refresh.

[Asking smart questions] [About Bear] [Books by Bear]
Sophia Choi
Ranch Hand

Joined: Mar 22, 2002
Posts: 106
So,after calling a function in setTimeout, do I use request.redirect function to refresh a page or other methods ?
Thanks a lot.
I agree. Here's the link:
subject: Refresh times to be one
It's not a secret anymore!