Does IE completely ignore cache control headers for AJAX requests?

Posted by Joshua Hayworth on Stack Overflow See other posts from Stack Overflow or by Joshua Hayworth
Published on 2010-05-03T22:50:03Z Indexed on 2010/05/04 0:18 UTC
Read the original article Hit count: 181

Filed under:
|
|
|

Hello there,

I've got, what I would consider, a simple test web site. A single page with a single button.

Here is a copy of the source I'm working with if you would like to download it and play with it.

When that button is clicked, it creates a JavaScript timer that executes once a second. When the timer function is executed, An AJAX call is made to retrieve a text value. That text value is then placed into the DOM.

What's my problem?

IE Caching.

Crack open Task Manager and watch what happens to the iexplorer.exe process (IE 8.0.7600.16385 for me) while the timer in that page is executing.

See the memory and handle count getting larger?

alt text

Why is that happening when, by all accounts, I have caching turned off. I've got the jQuery cache option set to false in $.ajaxSetup. I've got the CacheControl header set to no-cache and no-store. The Expires header is set to DateTime.Now.AddDays(-1). The headers are set in both the page code-behind as well as the HTTP Handler's response.

Anybody got any ideas as to how I could prevent IE from caching the results of the AJAX call?

Here is what the iexplorer.exe process looks like in ProcessMonitor. I believe that the activity shown in this picture is exactly what I'm attempting to prevent.

alt text

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about internet-explorer