0

Possible Duplicate:
What does '?' do in a Css link?

Some website pointing to static CSS files with ?9 at the end:

<link href="http://www.site.com/css/style.css?9" rel="stylesheet" type="text/css" />

I can easily understand if that file is PHP file, but I dont know what is the purpose of putting ?9 at the end of the href to a static CSS file.

Community
  • 1
  • 1
mesen jait
  • 29
  • 3

2 Answers2

3

Probably it's a version number. Static resources such as CSS are cached by client browsers. So by simply modifying the version browsers will refetch the new CSS there are updates. StackOverflow uses similar:

<link rel="stylesheet" type="text/css" href="http://sstatic.net/stackoverflow/all.css?v=ef2f2383c884">
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
3

The ?9 might be to prevent reading from cache by the browser. It's used when loading dynamic content from a static file, like so:

changingListOfStuff.txt?randomUselessPropertyToTrickBrowser=123456789

This forces the browser to use this exact file, not a cached version of changingListOfStuff.txt previously downloaded and stored by the browser. Caching speeds up loading time, but might provide an older version of the file if it changes rapidly.

Read more about caching here: http://en.wikipedia.org/wiki/Web_cache

Blender
  • 289,723
  • 53
  • 439
  • 496