我想将查询字符串“?v=123”附加到所有 .css 和 .js 文件,以强制客户端浏览器在新部署后下载样式表或脚本的更新副本。
这是否适用于所有浏览器? 对我来说,在 IE8、IE9、IE10、IE11、FireFox 和 Chrome 中工作很重要。
但是如果这在所有浏览器中都有效,我找不到信息。 如果有人有经验,请与我分享。
最佳答案
是的。
它是一个查询字符串参数,已成为specification 的一部分。自 1994 年以来:
An HTTP URL takes the form:
http://<host>:<port>/<path>?<searchpart>
where and are as described in Section 3.1. If : is omitted, the port defaults to 80. No user name or password is allowed. is an HTTP selector, and is a query string. The is optional, as is the and its preceding "?". If neither nor is present, the "/" may also be omitted.
关于javascript - 在哪些浏览器中查询字符串(以防止缓存)有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25398515/