如何强制硬刷新 (ctrl+F5)? [英] How can I force a hard refresh (ctrl+F5)?

查看:32
本文介绍了如何强制硬刷新 (ctrl+F5)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在积极开发一个使用 .Net 和 MVC 的网站,我们的测试人员正在尝试获取最新的内容进行测试.每次我们修改样式表或外部javascript文件时,测试人员都需要进行硬刷新(IE中ctrl+F5)才能看到最新的东西.

We are actively developing a website using .Net and MVC and our testers are having fits trying to get the latest stuff to test. Every time we modify the style sheet or external javascript files, testers need to do a hard refresh (ctrl+F5 in IE) in order to see the latest stuff.

我是否可以强制他们的浏览器获取这些文件的最新版本,而不是依赖于他们的缓存版本?我们不会从 IIS 或任何东西中进行任何类型的特殊缓存.

Is it possible for me to force their browsers to get the latest version of these files instead of them relying on their cached versions? We're not doing any kind of special caching from IIS or anything.

一旦投入生产,就很难告诉客户他们需要硬刷新才能看到最新的变化.

Once this goes into production, it will be hard to tell clients that they need to hard refresh in order to see the latest changes.

谢谢!

推荐答案

您需要修改您引用的外部文件的名称.例如在每个文件的末尾添加构建编号,例如 style-1423.css 并使编号成为构建自动化的一部分,以便每次部署文件和引用时都使用唯一的名称.

You need to modify the names of the external files you refer to. For e.g. add the build number at the end of each file, like style-1423.css and make the numbering a part of your build automation so that the files and the references are deployed with a unique name each time.

这篇关于如何强制硬刷新 (ctrl+F5)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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