I’ve been doing a lot of converting of web pages that required the user to refresh the page for updated content to AJAX (eliminates need to refresh). It was all good until I started receiving complaints that data was no longer refreshing in IE.
What I’m using is a AJAX get command like this:
however, in Internet Explorer, the content never gets refreshed – that is, the AJAX request is getting cached. There are a number of suggested solutions, including using a POST rather than a GET and appending a random string to the request.
The best way to keep AJAX working in IE is to tell the xmlhttp object not to cache content that is older than a certain date; you can do that by changing the request in this fashion (appending 1 line):
xmlhttp.setRequestHeader(“If-Modified-Since”, “Sat, 1 Jan 2000 00:00:00 GMT”);
This will solve any AJAX caching problem you might encounter. It’s a simple solution, but caused me a big headache!
Also, if you have webpages with ad code on them, each refresh is another impression and can skew your results more than you think! Move to AJAX and you’ll solve that problem :)
I hope this helps those of you playing with AJAX.