Using Meta Tag to refresh and redirect a page

Hi

 

Many a times we have a requirement where by we want to make a pager refresh by itself at a certain interval. We may also want to redirect the page to another page after a certain amount of time. I know we can do this with the help of Asp.Net Ajax Extension’s Timer control. But that can only be used when you are using Ajax in your page and more importantly should be used when you have requirement to update some small section of the page. For this requirement we can simply use a Meta tag in the Page header.

 

To refresh the page after a certain period of time, we can use the meat tag refresh. Here is how to use the tag (The tag should be added in the Head section of the page).

<meta http-equiv="refresh" content="300">

 

The content attribute defines the time in second after which the page should refresh. So in the example the page would refresh after every 5 minutes.

To redirect the page to another page after certain time we can modify Meta tag like this.

<meta http-equiv="refresh" content="2;url=http://www.VikramLakhotia.com">

 

Here the page will be redirected to given URL after the time mentioned (2 seconds here) in the content (attribute) before URL here.

 

Vikram

1 Comment

Comments have been disabled for this content.