用版本号链接CSS文件以清除缓存 [英] Link a CSS file with version number for cache busting

查看:86
本文介绍了用版本号链接CSS文件以清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

css文件的名称为: style.css?v = 1

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

html内的链接: < link rel = stylesheet href = style.css?v = 1>

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

与经典 style.css style.css?v = 1 无法识别:

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

我错过了什么吗?什么是版本控制文件的重要内容,语法?v = 1 从何而来?

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

推荐答案


  • 浏览器的表达式style.css?v = 1表示一个动态文件,例如将名为 v的参数设置为1的获取文件style.css。只要更改v参数的值,该文件就会作为新的唯一url获取。

  • 表达式style.css?= v1没有任何意义。

  • 表达式style.css?1也可以使用。

  • 这篇关于用版本号链接CSS文件以清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆