如何无效Web浏览器缓存内容 [英] How to Invalidate Web Browser Cache Content

查看:150
本文介绍了如何无效Web浏览器缓存内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经真正挖掘到谷歌网页速度快,优化了很多,我工作的地点就这一成绩好 - 而且相当成功,我可以自豪地说。

I've been really digging into Google Page Speed, optimizing a lot of the sites I'm working on to score well on that -- and quite successfully I'm proud to say.

我遇到的唯一缺点是,通过一些缓存的东西正在做,到JS和CSS的微小变化往往不会引起文件的新副本进行下载。

The only downside I've come across is that by some of the caching stuff being done, small changes to JS and CSS tend not to cause a new copy of the files to download.

是否有更改时的JS,CSS(或其他资源)作出强制一个新副本下载任何方式?

Is there any way when changes are made to the JS, CSS (or other resources) to force a new copy to download?

推荐答案

我遇到类似的问题,有时是JS和CSS缓存到长。这对我的作品的解决方案是,将最后一次更新的的versionNumber或时间戳的文件名作为查询字符串。这样,浏览器看到的文件发生变化,它会重新下载。

I'm running into similar issues sometimes that JS and CSS is cached to long. The solution that works for me is, adding an versionnumber or timestamp of the last update to the filename as querystring. This way the browser sees the file as changed and it will download it again.

可能是像这样来JS:

http://yourdomain.com/content/js/functions.js?v=201232

这篇关于如何无效Web浏览器缓存内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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