Link a CSS file with version number for cache busting

守給你的承諾、 提交于 2019-12-12 12:40:42

问题


css-file is named: style.css?v=1

the link inside of html: <link rel="stylesheet" href="style.css?v=1">


Contrary to the classic style.css the style.css?v=1 doesn't get recognised:

Failed to load resource: the server responded with a status of 404 (Not Found)

Did I miss something? What's important to versioning files and where does the syntax ?v=1 come from?


回答1:


  • The expression style.css?v=1 for the browser means a dynamic file like "fetch me the file style.css with a parameter named "v" set to 1". As long as you change the value of the v parameter, the file will be fetched as a new unique url.
  • The expression style.css?=v1 has no meaning.
  • The expression style.css?1 could also work.


来源:https://stackoverflow.com/questions/53429814/link-a-css-file-with-version-number-for-cache-busting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!