How To Refresh HTML Page After X Seconds?
Sometimes you want to refresh page after some time interval (e.g. 30 seconds). This could be if data are changed fast and you want to show correct values in real time. You can refresh HTML page automatically using refresh meta-tag.
Refresh meta-tag is located in <head> section. This example code refreshes (reload) page after 20 seconds:
<meta http-equiv="refresh" content="20">
Note that to short refresh time maybe will not work correctly because page haven't time to load. In this case, you can use IFRAME or FRAME tag and reload changed data in that frame only, or consider using of Ajax to reload only part of page.
Automatic redirecting with refresh meta tag
If you use code like in example above, refresh meta-tag will load the same page after every interval. There is an option to redirect to other page. It is useful if first page contains only some message (like &qout;Old page is moved, you will be redirected to new page after few seconds") and after that load second page. Code implementation could look like this:
<meta http-equiv="refresh" content="5;url=http://www.Your-Domain.com/Second-Page.htm" />
<title>This page is moved to new location</title>
This page is now located on other URL. If your web browser does not redirect you in a 5 seconds, click <a href="http://www.Your-Domain.com/Second-Page.htm">here</a>.
Practically all visitors will be redirected automatically, but example code includes static link for manual navigation in case that some user has some old browser that not supports refresh meta tag. Also, some browsers like Opera allows user to disable refresh tag. Notice that number of seconds and URL parameters are both inside content attribute, separated with ; (semicolon).
1. How To Refresh An ASP.NET Page?