I can see this site.com/assets/css/screen.css?954d46d92760d5bf200649149cf28ab453c16e2b
what is this random alpha numeric vales question mark ? i don't think it's taking some value to use or what is it about ?
edit : also on refreshing page the alpha-numeric value is same.

- 164,888
- 24
- 203
- 252

- 3,478
- 4
- 30
- 42
-
2Possible duplicate: http://stackoverflow.com/questions/2634123/what-does-the-question-mark-at-then-end-of-a-css-include-url-do – Sir_Faenor Jun 10 '15 at 08:17
-
2Its probably a cahebuster. When a server encounters `?anything` it will try to send this to the requested page and wait for a response, that way you are certain to get the most recent file. – somethinghere Jun 10 '15 at 08:18
1 Answers
It is for preventing the browser from caching the CSS. When a CSS is requested by some browsers, specifically Internet Explorer, the browser will have a local copy of the CSS.
When a request is given to a server as:
site.com/assets/css/screen.css?skdjhfk
site.com/assets/css/screen.css?5sd4f65
site.com/assets/css/screen.css?w4rtwgf
site.com/assets/css/screen.css?helloWd
The server at site.com
sees only:
site.com/assets/css/screen.css
And gives the latest version. But when the HTML page is requesting the browser to fetch the CSS as: site.com/assets/css/screen.css
, for the first time, it fetches from the site.com
server. There are many possibilities that the content might be changed in the meantime when the next request is sent. So programmers generally add a ?and-some-random-text
, which is called Query String. This will force the browser to get a new copy from the server.
Some more detailed explanation:
It is a well known problem that IE caches too much of html, even when giving a
Cache-Control: no-cache
orLast-Modified
header to everypage.This behaiviour is really troubling when working with querystrings to get dynamic information, as IE considers it to be the same page (i.e.:
http://example.com/?id=10
) and serves the cached version.I've solved it adding either a random number or a timestring to the querystring (as others have done) like this
http://example.com/?id=10&t=2009-08-06_13:12:56
that I just ignore serverside.Is there a better option? Is there another, cleaner way to acomplish this? I'm aware that
POST
isn't cached, but it is semanticaly correct to useGET
here.
Reference: Random Querystring to avoid IE caching

- 1
- 1

- 164,888
- 24
- 203
- 252