在Web应用程序的升级preventing浏览器缓存 [英] Preventing browser caching on web application upgrades

查看:181
本文介绍了在Web应用程序的升级preventing浏览器缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很头疼的问题,我没有找到一个还没有很好的解决方案。

I have a quite troublesome issue which I didn't find a good solution for yet.

我让我所有的应用程序静态文件(JS,CSS和图像)的缓存通过浏览器的性能。

I allow caching of all my application static files (JS, CSS and images) by browser for performance.

问题是,当我在做升级,用户仍然使用旧版本从缓存中,这往往打破了应用程序,并要求每次清理缓存来解决这个问题。

Problem is, when I'm doing upgrades, the users still use the old version from their cache, which often breaks the application, and requires clearing the cache every time to solve the problem.

是否有仍然允许缓存中的文件有什么好处多浏览器的方法,但在需要时可以强制重新加载它们?

Is there any good multi-browser approach which still allows caching the files, but can force to reload them when needed?

感谢您的任何信息。

推荐答案

附加somethign以URL为参数,例如 myresource.css?版本= 1 。该文件将被正确servered,这是一个把戏,迫使重新加载缓存。你只需要动态生成HTML页面。

Append somethign to the URL as parameter, e.g. myresource.css?version=1. The file will be servered correctly, that's a trick to force reloading the cache. You only need to generate the html page dynamically.

这篇关于在Web应用程序的升级preventing浏览器缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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