tags:

views:

295

answers:

2

Is it possible to pass a query string into a style sheet and if so, can the css process it?

i.e. http://www.domain.com/css/somestyle.css?id=102992992

I noticed when viewing basecamps source that the style sheet has a query string, but I don't see how it can be used.

Thanks

+4  A: 

Yes you can pass a querystring - no a plain CSS file can't use it.

There are two reasons to do it:

  1. The css file is being dynamically generated
  2. For versioning, to make sure the browser always gets the latest version (the id could be the last-modified timestamp, for example)
Greg
Yep, #2 is a fairly common way of doing cache-busting.
ajm
+1  A: 

A query string can be used to ensure that clients don't use old, cached versions of the referenced CSS file rather than retrieving the latest version from the server.

Derek Lawless