Forum Moderators: not2easy
notice after the style.css a "?" is followed by a bunch of numbers... i'd like to know what is this about?
cudnt find an answer on google as well, so thought id ask here. i know it maybe a silly question - its just that i dun know wots its about.
thanks
I've done this before in combination with browser sniffing to provide slightly different CSS files to different browsers, without the need for IE-only conditional comments. As a side benefit, it works for any browser, and can be done by any server-side language (assuming IIS or Apache web servers).
notice after the style.css a "?" is followed by a bunch of numbers... i'd like to know what is this about?
As said, it's added by a server side program, but I propose a different reason - to absolutely prevent caching. It's an old trick we used to use on images, too.
A "certain" browser known for it's difficulties has a bad habit of not clearing the cache when it's supposed to, or even when you tell it to. If I update my site this week with a new style sheet that has the same name,
mystyles.css
This browser will not always "know" its a new version so it will use last week's version. If you use CSS for positioning, this can be disastrous.
So a server-side language can generate a unique number and tack it on as a query string even though the query string is not actually used for anything. This way, every time the style sheet loads, it points to a unique name
mystyles.css?1234567890
And forces the browser to download the new version instead of using the cached version.
This old trick is also useful for dynamic web sites where identical file names are used, but an image is replaced with a new version, as in a "picture of the day" application.
myimage.jpg?1234567890
This works on other browsers too. :-)