开发者

What does ?v=2 mean in css? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

What does appending “?v=1” to CSS and Javascript URLs in link and script tags do?

When I download a files from http://html5boilerplate.com/, it has ?v=2 in css.

What does i开发者_开发技巧t mean and how does it affect to loading css?

<link rel="stylesheet" href="css/style.css?v=2">


If you set caches to expire far in the future adding ?v=2 will let the server know this is a new file but you won't need to give it a unique name ( saving you a global search and replace)


The query string is passed to the webserver, like you would with a script. I imagine the CSS file referenced is not actually a CSS file, but a script that serves a dynamic version.

The URL is no doubt rewritten to a script which uses the variable v (probably standing for version) to know which CSS variant to supply.


Its mainly used to takes care of browser cache.

If your website has that version no and if tomorrow you change the javascript and deploy new file you can update the version no from 2 to 3.

Then browser instead of loading from cache, it loads from server. So that end users won't see the old javascript file.

This is one of main uses of giving version no.


v2 = version 2, when using version control. it shouldn't affect the actual css iside the file at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜