开发者

?+n numbers after a path in a link in the head of web pages

I see in the source of a lot of web sites links like &开发者_如何学Pythonlt;link rel="stylesheet" type="text/css" href="/css/screen.css?4011091616" /> What are the ?+n numbers in the end of the href?


This is called chache busting.

It adds a single get variable which is never used by the css file, but creates a unique URL for the purposes of caching the resource.

Each time you make a change to the resource, you simply add another number to the extra parameter meaning any return visitors will be forced to retreive the resource from the server again.

Eg, first the URL may be:

www.example.com/mystyle.css

then:

www.example.com/mystyle.css?v1

then:

www.example.com/mystyle.css?v2

and so on...


I have seen proxy servers do that in order to make the URL unique whilst still fetching the same resource.

They are effectively setting a GET variable without a value, which would be enough to identify the URL later, without disrupting the resource.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜