tags:

views:

422

answers:

2

My designer noticed that in the source for a drupal site, all the .css files were getting appended a ?1 that he was concerned would break things. Why is it doing this?

<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/node/node.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/defaults.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/system.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/system-menus.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/user/user.css?l" />
+8  A: 

I poked around in the source code for drupal and found this:

// A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache
// flush, forcing browsers to load a new copy of the files, as the
// URL changed.
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);

I guess that answers that. I'm going to assume since the drupal guys are doing this that browsers are cool with query strings in css link tags, even though my designer was paranoid over it.

Hopefully this helps somebody one Google on day =p

easel
@easel: You should mark this as the accepted answer (doesn't matter that it is your own)
Henrik Opel
thanks for the hint =p done
easel
+4  A: 

Following blog post explains this practice too: mod_expires and Cache Killers

Peter Štibraný
cool, thanks. Some good details there!
easel