如何通过重命名CSS文件,以避免浏览器缓存问题 [英] How to avoid browser caching issues by renaming css file

查看:208
本文介绍了如何通过重命名CSS文件,以避免浏览器缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在的site.css文件中的一些不好的CSS,这已经从用户的浏览器缓存,是那么可以简单地将文件与固定CSS重命名,以有以前是用户的浏览器重装数据缓存?

If i have some bad css in site.css file and this has been cached from the user's browser, is it then possible to simply rename the file with the fixed css in order to have the user's browser reload data that had been formerly cached?

如果没有,有没有办法致力于模拟清除浏览器缓存?

If not, is there a way to mimick clearing a browser cache?

感谢

推荐答案

如果你只是一个虚拟的查询字符串值添加到CSS参考,因为不同的URL意味着不同的资源浏览器将获取该文件的新副本。例如

If you simply add a dummy querystring value to the css reference the browser will get a fresh copy of the file since different url means different resource. For instance

styles.css?anything=1

重命名该文件将工作太但这是没有必要的。

Renaming the file would work too but that's not necessary.

这篇关于如何通过重命名CSS文件,以避免浏览器缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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