-3

如今,在大多数网站上,我都看到这样的网址

http://example.com/style.css?v=024741259dd2

其中 style.css 附加了一些文本。这个附加文本是什么版本号或日期和时间?如果是,它是如何生成的?这有什么意义?

4

1 回答 1

3

it is probably a "random" number (e.g. a file checksum, or the SHA of a commit under a versioning system, or the resource timestamp in MD5 format, or...) generated automatically on server-side as a cachebusting technique. The purpose is to invalidate the browser cache for that resource if you've already loaded it and a change was made.

As example, I always use that technique while I am developing a website with Jekyll and Jekyll-assets, so I can be sure to always see my recent changes without reloading my javascript and stylesheets file from the cache.

于 2013-06-26T08:40:58.567 回答