Cache control problem with IE6 when do Ajax site call XML API

When create ajax site, we let client browser use js to make some call to our API services (REST). API function return output as XML (our format). Then the js at browser parse the return XML to display some fancy on screen.

Firefox, Mozzila base work fine, but IE6 is so stupid and lazy. IE6 cache the return XML data, and later call to API (with the same URL), IE6 take data from it internal cache, avoid calling from API.

To avoid it, our API server must send some header(s), tell the browser (client) NOT TO CACHE the XML data (fetching from API). You must do it from SERVER, remember.

Here is correct sequence (write in PHP), work for IE6

header(“Expires: Mon, 26 Jul 1997 05:00:00 GMT”);
header(“Last-Modified: ” . gmdate(“D, d M Y H:i:s”) . ” GMT”);
header(“Cache-Control: no-store, no-cache, must-revalidate”);
header(“Cache-Control: post-check=0, pre-check=0”, false);
header(“Cache-Control: private”);

But, beside the problem with IE (while using js, make ajax call to XML file), using caching with API oriented and ajax call is very sweet.

Some resource I found here about caching:


5 thoughts on “Cache control problem with IE6 when do Ajax site call XML API

  1. Review the mod_expires from your Apache server config.

    # Set far-future expiry for images, css, and js
    # Remember that you MUST change the filename whenever you update these items!

    ExpiresActive on
    ExpiresDefault “access plus 10 years”

    ExpiresActive on
    ExpiresDefault “access plus 2 months”

  2. If you want to grow your experience just keep visiting this website and be updated with the newest gossip posted here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s