skip to main content

TAMU Webmaster's Blog


Information and insight from the A&M Webmasters

Beware the Browser Cache

September 11th, 2008 by Erick Beck

Browsers cache .css pages. We all know this, but sometimes they keep hold of them longer than they should, and each browser’s differing behavior is not well documented. Add on to this the ability of users to customize how their browsers handle cached information and you quickly develop a sticky situation.

We got caught by this today when we posted the university closings to the university website. Not long after the announcement went up we got a call saying that the notice had first appeared with maroon links, and then after they refreshed the page the links had turned yellow. It was immediately obvoius that their problem was a caching issue, but why? Because we made the updates to the bottom of the standard style sheet and since their browsers kept hold of the cache for too long (even between browser restarts.) The new styles were not loaded until they refreshed their page. Easy to solve – create a new .css file that nobody had ever downloaded and link it from the front page. Problem solved, now everybody gets the right styles. But lesson learned the hard way – if you have a change that you want to absolutely positively guarantee that everybody sees right away, you MUST rename the .css file, put it in a different .css file, or do something to defeat those over-stngy browser caches.

Have a safe weekend, and don’t forget about the Web Accessibility Showcase next week…

Thursday, September 11th, 2008 Browsers/Plug-ins, www.tamu.edu
Share this article

1 Comment to Beware the Browser Cache

  1. My favorite way of handling this is to append a query string, like a date stamp or a version number, to the CSS file’s URL (e.g. /style.css?092008). It doesn’t affect the file, since it’s not dynamic, but a changed query string will force the browser to download a fresh copy of the file. There are some tricks to do it automatically with PHP, JavaScript, or Apache settings… see here and here.

  2. Stephanie Leary on September 11th, 2008

Leave a comment

Categories

Archives