Redirect and refresh a page using the Meta tag

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


Share this post   Email it |  digg it! |  reddit! |  bookmark it!

Feedback

Posted on 3/19/2008 10:05:57 AM

It is a good feature.
thanks to Vikramlakhotia.

Posted on 4/7/2008 3:16:38 AM

A+ !
Great got me exactly what I needed.
Thanks

Posted on 7/9/2008 3:45:12 AM

Thanks Vikram,
this is great way to redirect page through meta tag, this is nice article.

Santosh Kumar
http://www.operativesystems.com

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 
Copyright © 2006 - 2008 Vikram Lakhotia