|
Design Tip:
Some META Tags Don't Work
by Larisa Thomason,
Senior Web Analyst,
NetMechanic, Inc.
Are you sure that visitors always see the new content after you update your Web site? Unless you're careful, visitors may see pages that have been saved in their browser or ISP's cache files. META tags seem like an easy way to control caching, but they don't always work.
How Caching Works
When you visit a Web page for the first time, your browser requests a copy from the Web page's server. You may wait a long time for large sites to download. However, if you go back to the Web site later, it will generally load much faster - even though your connection speed hasn't changed.
Why? When you requested the page the first time, your browser saved a copy of the Web page in a file on your PC so there's no delay while it downloads. That's called a local or browser cache.
The customers of a single ISP or employees behind a corporate firewall might use a public proxy cache. This is a much larger version of a browser cache. A proxy server uses its cache file to save copies of the files that many users have requested.
When you request Web page, several things happen:
- Your browser checks your browser cache to see if there's a copy already saved. If so, the page and associated images appear immediately
- If not, the browser asks the proxy server if it has a copy.
- If so, the proxy server retrieves the files from its cache and sends them to the browser.
- If not, the proxy server requests the files from the Web server, saves a copy, and sends them to your browser.
|
Cached pages load faster. Your visitors see pages more quickly. Your server avoids a lot of unnecessary traffic.
META Cache Controls
You might wonder though: with all these saved files being transferred, how can you be sure visitors see your updated pages?
Not with META tags - at least not all the time.
Most browsers understand the META tags that set a page expiration date or a no-cache instruction like this:
<META HTTP-EQUIV="Expires"
CONTENT="Sun, Apr 1 2001 13:00:00 GMT">
|
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
If the user requests the page on April 2, the browser would request a new copy of the page because the date had expired. Or, if you had set the page to not cache at all, the browser would always request a copy.
The catch: a public proxy cache may return a saved copy instead of the updated one. Many proxy servers can't read META tags. You just have to hope that the correct page is saved in the proxy's cache.
Why META Cache Controls Don't Always Work
Note that the META tags in our example both used the HTTP-EQUIV attribute, which tries to mimic HTTP header information. HTTP headers control how both browser and proxy caches handle your Web pages. They are invisible in HTML and usually generated automatically by your Web server.
Some servers can translate HTTP-EQUIV content into header data, but this is an optional configuration! Don't assume that all or even most proxy servers are configured this way. Many servers never look at a page's HTML code at all.
For instance, AOL's proxy servers ignore documents' HTML content entirely, so they never see your HTTP-EQUIV data. You'll have to use actual HTTP headers to be sure that AOL's 27 million members see your updated pages. AOL's Webmaster Information section describes their caching system in detail.
HTTP Headers Are Reliable
HTTP headers are the only way to reliably control caching. You can set page expiration dates and page caching instructions using HTTP headers. Learning how may take some time and research though. Manipulating HTTP header data by hand requires both knowledge of HTTP protocols and access to your site's HTTP header data. The Web Developer's Virtual Library has a tutorial on caching that includes an in-depth discussion of HTTP header information.
Contact your Web host for instructions on how to set them up on your site. If your host won't give you access, consider moving your site somewhere else. You need this information to administer your Web site.
Although they're unreliable for some tasks, don't assume that META tags are worthless!
In fact, META tags are a crucial component of your Web site promotion strategy. Most search engine spiders use META tag information to properly index your site's content and rank your site. NetMechanic's Search Engine Power Pack includes a META tag generator tool that helps you write META tags for your Web site.
|