[support] CSS Links in generated HTML

Ramon Vilar Gavaldà ramon.vilar at gmail.com
Tue Sep 15 11:11:56 UTC 2009


Hi Martin
The parameter that Drupal passes to the stylesheet link (?5 in your
example) is to manage your browser cache.

A browser cache works as follows:
- If it request a resource located in A, it looks if it's in its
cache. If it isn't located, the request is launched. When the response
(R) arrives, the browser creates an entry in its cache like A -> R to
use it in other request.

In this case, Drupal passes a parameter to the stylesheet, js and
other static resources to manage the browser cache, and its refresh
rate. If you look, the URL (the parameter) changes when we changes our
css or js files:

Before the change:

<link type="text/css" rel="stylesheet" media="all"
href="/drupal/modules/node/node.css?5" />

After that:

<link type="text/css" rel="stylesheet" media="all"
href="/drupal/modules/node/node.css?6" />

(?6 is a example)

So now your browser clear the cache and performs the request to locate
the new file.

Do you understand that? (my english needs a big improvement...)

Ramon



2009/9/15 Martin Hooper <martin.hooper at gmail.com>:
> Looking at my generated source code for pages what are the ?5 at the
> end of each stylesheet link?
>
> <link type="text/css" rel="stylesheet" media="all"
> href="/drupal/modules/node/node.css?5" />
> <link type="text/css" rel="stylesheet" media="all"
> href="/drupal/modules/system/defaults.css?5" />
>
> I'm just curious thats all as I have never seen a decleration of a
> stylesheet like that before!
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
Ramon Vilar Gavaldà - http://ramonvilar.facil.cat - http://blog.facilitant.net
Membre de FÀCIL - http://www.facil.cat
Membre de l'esplai SESA - http://www.esplaisesa.org


More information about the support mailing list