wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Refresh times to be one" Watch "Refresh times to be one" New topic
Author

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 ?
Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

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.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [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: http://aspose.com/file-tools
 
subject: Refresh times to be one
 
Similar Threads
Refresh page programatically
refresh a page
how to reload a jsp page ?
Handle window close event
refreshing jsp page