1

I have recently purchased a theme and the theme contains the following code in HTML;

 <link rel='stylesheet' id='font-awesome-css'  href='css/font-awesomef43b.css?ver=3.7.1' type='text/css' media='all' />

So, I was wondering what is the usage of ?ver=3.7.1. Any help is appreciated.

Ash Burlaczenko
  • 24,778
  • 15
  • 68
  • 99
user2699298
  • 1,446
  • 3
  • 17
  • 33

2 Answers2

6

Resources are cached on a per-URL basis. By changing the query string when you release a new version, you change the URL and burst any caching without having to use a different filename for a statically served resource.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Additionally, if you are looking at stuff like pageSpeed insights, adding the parameters on the end of the URL will ding you points. I have assumptions based on why. Does a URL param on an asset, if never changed, prevent optimal caching or something? If it's there does it never cache it? I would assume it could still cache it like normal. So why does page speed insights say it's bad practice for speed? I assume its possible the page could be cached is other locations besides the browser if it's no there? – Leeish Dec 21 '13 at 17:43
1

This constructs are used to overwrite caches when any library is changed. Cause every asset on the webpage can have caching period and if you change something in code (e.g. javascript), user browsers that have this asset cached will use old version and they won't see changes or bugfixes. Using version in query string you will cause overwrite of cache if the version changes.

Arman P.
  • 4,314
  • 2
  • 29
  • 47