Page refresh and redirect through meta tagsWe can refresh a page at a particular interval by using Meta refresh tags within the head area of a page. User doesn't have any control over the refresh rate of the page. This is usually used where page content changes over time. A page showing the cricket score has to refresh itself to display the current score. So at a particular interval the page reloads by meta refresh tag and collects the fresh score from the server. Here is the basic command used to refresh a page.
<meta http-equiv="Refresh" content="15">Here the page will refresh after every 15 seconds.
Redirecting using meta refresh tagsWe can use the same technique of refresh to redirect the page to a new location or a URL. Here by changing the time we can control the duration for which the current page will stay or load before the redirection takes place to new URL. Here is the code.
<meta http-equiv="Refresh" content="15;URL=http://www.google.com">Here the page will redirect to google.com after loading for 15 seconds.
This type of meta redirection is different than header redirection. In a header redirection browser does not load the source page so it has no effect on header information the browser already have.
Page refresh by using buttonIn addition to automatic refresh by meta tag, we can give a button which can be used by visitors to refresh the page before the meta refresh takes effect.
<input type=button onClick="location.href='refresh.php'" value='click here to refresh this page'>: