Does your site run on Perch CMS? Hire me to help. Perch CMS Development

Add a query string to your style sheet link for cache busting

Posted on by Clive Walker in CSS Web Design

I wrote this post a while back. The content can still be relevant but the information I've linked to may not be available.

I was looking at the UX London website recently and I noticed that their CSS files are referenced with a query string like this:

<link rel="stylesheet" type="text/css" 
          href="/css/screen.css?20090108" media="screen">

The query string [20090108] looks like the date. This seems to be a rather neat method of preventing style sheet caching when your CSS changes. It's not something that I have come across before but it's a clever idea implemented by Jeremy Keith and Natalie Downe at Clearleft.

Update: Confirmed on adactio's Twitter stream

Does your site run on Perch CMS? Hire me to help. Perch CMS Development

Comments

  • 14 Feb 2009 22:57:49

    Interesting article, does the query string need to be added to every page or just the homepage?

    Many thanks

  • 15 Feb 2009 09:26:35

    You will need to ask the original authors about this but the UX London website uses it on all pages [at least, all the pages I looked at].

Comments are OFF for this post.

© 2024 Clive Walker