Alex Rivera | Logout

How can I force a hard refresh (ctrl+F5)?

Asked 2009-06-01T20:32:24.527
27

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.

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.

Thanks!

Edit
Report

1 Answer

1

In your references to CSS and Javascript files, append a version query string. Bump it everytime you update the file. This will be ignored by the web site, but web browsers will treat it as a new resource and re-load it.

For example:

<link href="../../Themes/Plain/style.css?v=1" rel="stylesheet" type="text/css" />
<script src="../../Scripts/site.js?v=1" type="text/javascript"></script>
answered 2009-06-01T20:39:10.940

Your Answer