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"?

5
  • 2
    Use a private browsing window, maybe?
    – Josh Lee
    Commented Dec 9, 2009 at 23:54
  • 3
    Is it possible that your web server is serving the old page (via cache) instead of the new version? Doesn't matter how many times you reload in that case. Commented Dec 9, 2009 at 23:56
  • 1
    Michael, no, I verified in Fiddler that IE is not getting the page contents from the server.
    – EMP
    Commented Dec 10, 2009 at 0:06
  • Control+F5 goes past the Cache, it's odd if it doesn't.... Commented Jul 14, 2010 at 19:41
  • 3
    Best wording of a question I have encountered so far on StackExchange!
    – user785529
    Commented Jun 7, 2016 at 12:49

12 Answers 12

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.
7
  • 3
    If this is what you did, mark it as the answer
    – Earlz
    Commented Dec 10, 2009 at 0:15
  • 38
    It may hurt general browsing performance, but only if you do your general browsing with IE... Commented Dec 10, 2009 at 1:07
  • 3
    Ev: The user-facing side of this is usually fixed by changing the URLs for all scripts and stylesheets every time you touch the code, typically by adding a ?version-number query string suffix.
    – bobince
    Commented Dec 10, 2009 at 1:53
  • 4
    "Every time I visit the webpage" likely doesn't do what you think it does. See fiddler2.com/redir/?id=httpperf
    – EricLaw
    Commented Jan 5, 2010 at 20:33
  • 6
    I agree with @EricLaw, if you use Fiddler you will see that files associated with the page are sometimes not reloaded even when "Every time I visit the webpage" is set. Use the IE toolbar menu: Cache > Always refresh from server, or the Clear Cache button in Fiddler. Commented Mar 4, 2010 at 17:32
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.

4
  • +1 for solving this without using a global option. Commented Dec 12, 2012 at 13:48
  • Similar to here, that still doesn't always refresh all content. And I don't know that that reload is good across URLs either -- each window seems to have its own F12 at times. This is a more thorough way to do if, iff you have access to the javascript include.
    – ruffin
    Commented Feb 4, 2013 at 15:15
  • 1
    How do you do this in IE 11? There's no cache option I can find. Commented Jun 17, 2014 at 14:33
  • 5
    In IE 11 this option is under F12 -> Network -> 3th icon from left.
    – Den
    Commented Aug 3, 2015 at 9:00
22

Ctrl+F5 in IE reloads the page ignoring the cache

7
  • 27
    No, it doesn't. I know it ignores the cache some of the time, but not all the time.
    – EMP
    Commented Dec 10, 2009 at 0:56
  • 16
    Ctrl+f5 always reloads the page from the server. What it doesn't necessarily do is reload the extra files that page references
    – Chris
    Commented Dec 10, 2009 at 1:53
  • 2
    Fair enough - but I need it to reload EVERYTHING.
    – EMP
    Commented Dec 10, 2009 at 5:55
  • 1
    CTRL+F5 should perform a full refresh of the page and all of its resources. Calls made via XMLHTTPRequest later might be cached (if you don't want them cached, send appropriate no-cache headers). The one caveat is that if the page in question is XML, it's really being loaded via MSXML, and that DocHost does NOT respect CTRL+Refresh properly.
    – EricLaw
    Commented Jan 5, 2010 at 20:32
  • 3
    ctrl+f5 does not always reload everything from the server. In my tests javascript contained in the html file do not reload after pressing ctrl-f5 even though the page has changed.
    – rcarver
    Commented Dec 2, 2011 at 13:15
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.

2
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.

4

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

1
  • Does that function differently than Ctrl-Refresh button? Commented Apr 10, 2013 at 22:14
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.

1
  • Makes URLs ugly, though.
    – LawrenceC
    Commented Aug 22, 2012 at 18:38
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.

2

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

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.

1

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

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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .