One of the bugs features of Internet Explorer is it’s insistence on caching anything and everything. IE caching has cost me many hours of debugging time since I started doing Ajax development last year.
My most recent problem was a form I had that described an image. I would modify one of the fields in this form and save it, but the change didn’t reflect when I reloaded the page. After ruling out the PHP code and the database as the source of the bug, I did some research about caching in IE (since this problem didn’t occur in any other browser).
What I found was that you have to be careful when making ajax GET requests in IE. If you make a request to a URL with the same query string as another request made recently, IE figures that the page won’t have changed, so it pulls it from cache. Once I found this, it was a snap to avoid the problem.
There are two ways to handle this. One is to use POST request all the time. I don’t like to do this unless I’m submitting a form, so I use the second method which is to make the GET query string unique. I do this by adding a random string at the end:
http = createRequestObject();
var d = new Date();
var time = d.getTime();
var url = 'library.php?' + action + '&time=' + time;
http.open('GET', url,true);
http.onreadystatechange = handleResponse;
http.send(null);
This way, IE will never try to use a cached copy of your page.








Is this with IE6, IE7, or both?
I was only able to check with IE6, but at this point IE6 is still the most popular browser. Have to code to the lowest common denominator
Tried all shapes to get this to work, I HAD to use post in the end. Nice article though, cool, keep em coming
This is the BEST script on web for killing f****** I.E. bugs!
Easy way to resolve i.e. bugs is to install and use only FireFox!