This one came to be as such a big surprise that I had to Google it several times to make sure it is not my own mistake.
Today I was debugging one of my latest web applications. It has some controls that allows the user to set some parameters on the server:
See what other developers wrote about it:
I was tearing my hair out trying to work out the cause of this problem… (Jeremy Epstein)
Strictly speacking IE caches Ajax GET requests, therefore making all your web2.0 tricks effortless! (Daniel Vecchiato)
This can be a nightmare to deal with, as you cannot ask all users of a web site to change their browser settings. (Dan Nye)
I’ve never encountered a case where I want ajax to NOT contact the server. (Dean Moses)
Since it is a really frustrating “design feature” of Microsoft IE, I decided to write about it here. This aggressive solution apparently tries to improve the speed of Internet Explorer but it doesn’t help the infamously slow browser. In fact this solution to speed up a browser is like putting two virtual reality LCDs instead of a car’s windshield and simulate a fast moving car by showing movies of driving in fast road. The car’s engine is so weak that it cannot even drive in standard roads! Microsoft should realize that in the world of free speedy real cars, users would hardly choose a virtual reality one, even if it comes pre-installed in their garage when they buy a home!
The best solution for Internet Explorer team is to follow web standards. If you cannot interpret standards, cheat! Just check how open source browsers like Firefox implement it and follow their lead. It’s the only case where cheating hurts less than not cheating!
Various web developers have suggested workarounds for the issue. Check out the links of the quotes above. There are mainly 3 solutions:
- add a timestamp as an extra parameter to every request so that IE thinks it is a different request and doesn’t load it from cache. Of course the server ignores this parameter.
- use “POST” requests instead of “GET”. Apparently IE just caches GET requests.
- the server response can add a header to the response that explicitly asks the browser not to cache it.
- for debugging purpose it is possible to ask IE to behave “normally”: