157

When using Internet Explorer 8 to test my web application I often find it doesn't reload the page, so I don't see my changes. This has resulted in a lot of wasted time and frustration wondering why my fix "didn't work" - when in fact the browser never loaded the fixed version.

I've tried the Refresh button. I've tried F5, Control-F5, Control-R, Control-Shift-R, holding Control while clicking the Refresh button, everything I could think of - it doesn't actually load the new contents from the server. I've confirmed this with Fiddler.

How do I tell IE "I don't care what you think you have cached, I want to reload the page - no really, I mean it this time, honest-to-God, I want you to actually go to the server and download everything again"?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
EMP
  • 4,998

12 Answers12

130
  1. Select Tools >> Internet Options.
  2. Click the Settings button in Browsing History.
  3. Select the Every time I visit the webpage radio button.
  4. Click OK to close the Settings dialog.
  5. Click OK to close the Internet Options dialog.
Dave Jarvis
  • 3,427
43

Since it's stated that IE8 is the browser, you can press F12 to open the development tools and select the Cache menu at the top and then always refresh from server to bypass cache.

In short, Press F12. Click Cache -> Always Refresh from Server

You can simply clear your cache here as well, if that is the desired action. The always refresh option is not a global option and will not hinder overall performance in IE.

IE7 also has development tools, but they must be installed separately. You can also use the IE8 dev tools to run the browser in IE7 mode.

CyberSkull
  • 1,505
Brandon
  • 431
22

Ctrl+F5 in IE reloads the page ignoring the cache

CyberSkull
  • 1,505
mfeingold
  • 357
19

IE is very eager to cache pages, even when you tell it not to via cache headers. Microsoft KB 234067 explains the requisite incantations. In short, you need to deliver the following headers.

Pragma: no-cache
Cache-Control: no-cache
Expires: <some time in the past>

Setting Expires = -1 (as recommended in the KB article) should work for most frameworks; browsers are required to treat invalid date formats as being in the past (RFC 2616).

In .NET, you can do it on a page-by-page granularity by using this set of methods prior to calling the web page:

HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Response.Cache.SetValidUntilExpires(false);
HttpContext.Response.Cache.SetRevalidation(System.Web.HttpCacheRevalidation.AllCaches);
HttpContext.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
HttpContext.Response.Cache.SetNoStore();

see: http://www.localwisdom.com/blog/2012/10/force-a-page-refresh-on-a-asp-net-mvc-website/ Works well for MVC3.0.

sscheider
  • 103
6

The Network tab of the web developer toolbar has a button to easily clear the cache. I usually use that in the case you describe.

It isn't ideal, since you may not really want to clear your entire cache, but since I don't use IE for general browsing, it works for me.

pkaeding
  • 1,490
4

This still happens in IE9. Amazingly, the answer is Ctrl-Shift-Refresh button

CyberSkull
  • 1,505
PandaWood
  • 141
  • 3
3

Incidentally, the problem will possibly exist for your website viewers as well. I saw the following idea in an AJAX book...

Use PHP to add a random token to the current URL so that the browser is tricked into thinking it's a separate page.

Moshe
  • 5,908
2

Hold down either the alt or ctrl key as you click refresh button.

CyberSkull
  • 1,505
niaccm
  • 21
2

I've had the same problem myself. I believe the only way to do it is to clear the cache (Safety -> Delete Browsing History). Only check "Temporary Internet Files".

Hope this helps.

jchapa
  • 241
1

I agree that adding a random token to the url is the most reliable solution and once it's implemented the user doesn't have to do anything.

Aside from the random token approach what I tend to always do to force a complete reload (request) of the page and all of its dependant files I just place my cursor at the end of the url and press Enter. Works every time... and I use IE 8.

Jerry
  • 11
1

F12 -> CTRL+R is slightly faster for IE9+. As people have mentioned, IE doesn't clear the cache very intelligently like Chrome does.

CyberSkull
  • 1,505
Chris S
  • 883
1

I know this may seem a bit odd... but one thing I've noticed lately, is that you do sometimes get different results depending on HOW you "refresh". I've seen the following behaviour:

F5 > loads from cache without refresh,
Alt+D, ENTER > really refreshes bypassing the cache.
(Alt+D can be replaced with clicking in the address bar)

eidylon
  • 1,829