Refresh meta tag in GWT
How 开发者_开发问答can we achieve what the below HTML meta tag can do, in GWT?
<meta http-equiv="refresh" content="30" />
If you want the browser to automatically refresh every 30 seconds, you can accomplish that with:
new Timer() {
@Override
public void run() {
Window.Location.refresh();
}
}.schedule(30000); // milliseconds
This is using schedule()
instead of scheduleRepeating()
because reloading the page like this will cause your GWT code to stop and restart fresh from the beginning. You probably want to avoid this.
I'll be honest, this practice "smells" pretty bad to me. If you give a little more information about why you would want to refresh the page every 30 seconds (thus requiring your GWT code to be reloaded), I can probably give you advice about how to better do what you want to do.
精彩评论