Can't the browser just use its cache from prior ajax calls? Can't the browser just use its cache from prior ajax calls? ajax ajax

Can't the browser just use its cache from prior ajax calls?


Ajax caching is possible and predictable (at least in IE and Firefox).

This blog post discusses Ajax caching and has a demo web page:

http://blog.httpwatch.com/2009/08/07/ajax-caching-two-important-facts/

There's also a follow up by Steve Souders on the F5 issue:

http://stevesouders.com/tests/ajax_caching.php


The short answer is no. Unfortunately, browsers do not reliably cache AJAX requests in the same way that they do "normal" pages. (Although the data may in fact be cached, the browser often doesn't use the cache when handling AJAX requests the way you would expect.) This should change in the future, but for now you have to work around it.


You may want to check your resources using the Resource Expert Droid, to make sure they’re doing what you intend. You should also run a network trace to double-check the request and response headers, using something like Wireshark, in case Firebug isn’t telling the full story.

It’s possible that jQuery is including some request headers in a way that the browser decides should bypass the cache. Have you tried a plain XMLHTTPRequest without a framework?