1. Technology

Manipulating the Cache

Controlling How Your Readers See Your Pages


Web servers and browsers use a tool called a cache to help pages load more quickly. Under normal circumstances, when you go to a Web page, your Web browser stores a copy of it and all the images on it on your hard drive. This cache of pages allows the browser to display pages faster the second time you go to the page. This caching can be controled by the user and the Web developer.

Along with browser level Web caching, there is also server level caching. This acts in the same way as browser-level caching, but at the server itself. It is often set up by Web managers to reduce the load on their servers. This type of caching cannot be controlled by the user. It can, to some extent, be controlled by the Web developer.

How Web Developers Control the Cache

If you want to control the cache in your readers' browsers, you need to use meta tags in the head of your document. Before you go and put these tags in all your pages there are two things you should remember:

  1. Not all browsers and servers support these tags
    These are not the ultimate way to prevent your pages from being cached. In fact, there is really no way to guarantee that.
  2. Caching serves a valuable purpose
    Caching does help pages load more quickly, and reduces strain on Web servers.

You can force your pages to load from the server every time someone comes to the page or after a specific date (ie. if you update once a week, you can set it up to refresh only after your update date).

Every Time
Place this tag in the head of your document:

<meta http-equiv="expires" content="0" />

After a Date
Place this tag in the head of your document, make sure that the date is written in full:

<meta http-equiv="expires" content="Mon, 10 Dec 2001 00:00:00 GMT" />

Previous Features

©2014 About.com. All rights reserved.