Meta refresh, redirect and cache control

Now and again I need to redirect a page to another site or page and it’s infrequent enough that I forget, perhaps now I’ve written this down I might remember it, at the very least I’ll have a quick reference doc.

Redirection and Reloading 

Simple redirect and refresh can be done from a META tag with a timer and the target URL, don’t forget to put the html statements inside angle brackets.Reloading or refreshing can be achieved using the line below, noting I’ve set it to be 3600 seconds.

 meta http-equiv=”refresh” content=”3600”

Setting a timer to count down and load a different page in the current window is a simple extension as shown below.

 meta http-equiv=refresh content=”5, URL =http://www.google.co.uk”

Controlling Caching

There is also a second useful component to add if you don’t want to indicate the cache relevant status of your page, this sort of supersedes the ‘pragma no-cache’ approach.

 meta http-equiv=”Cache-control” content=”keyword”

The keyword can be one of the following

  •  public – Allow public and shared caching
  • private – Private caching only
  • no-cache – Don’t cache
  • no-store – Cache but don’t archive

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s