Coldfusion: IE Cache problem with repeating Ajax Requests
Later some users might report that in Internet Explorer (6.0, 7.0 and 8.0) content that you refresh via Ajax requests might not get updated.
Suppose you have a HTML page that contains an Ajax Request to a .cfm file to get the content of the users inbox. The .cfm file returns a JSON string with all items in the inbox. This request might look something like this:
The json.cfm will return all items for this users inbox (depending on the Session.UserID of course).
When you first load the page everything works fine. You load the page, the page requests http://yourdomain.com/ajax/json.cfm?do=inbox and renders the inbox with its items.
BUT: When the user now returns to this page within the same browser session the Ajax request will be answered from IEs cache.
Turns out your need to set the correct HTTP headers to really prevent IE from caching your Ajax requests:
The bad thing about this behavior in IE is, that it is not really creating an error or anything it is simply using old or stale data when it shouldn’t. While you test your application you will only realize this if you extensively test your application in IE against this.
For my part i work with Firefox, Safari or Chrome and test most apps there. I check if everything works fine from time to time in IE but this issue is something that will clearly not be noticed at first sight. Hope the above helps you.
If you've read this far you might as well follow me on Twitter here.