Page 1 of 1

IE 7 caching problem

Posted: Tue May 27, 2008 6:40 am
by coderb
Hi All,

I've got a simple AJAX routine that populates an incrementing field based on a ddl selected item.

it works fine, but when I go back into the page, select the same item from the ddl, it should cause the field value to increment again, but IE 7 just repopulates it with the cached value - no doubt it assumes that because the selected value has not changed, I don't need a new result.

I thought that adding the following the parent page would do the trick:

this added before any html:
Header("Cache-control: private, no-cache");
Header("Expires: Mon, 26 Jun 1997 05:00:00 GMT");
Header("Pragma: no-cache");
Header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");

this in <head> tag:
<META http-equiv="expires" content="0">

but still IE 7 does not work. Firefox, Opera and Safari are fine.
when I delete the IE browsing history, then try again IE increments the value correctly.
so how can I force IE 7 not to cache this value or not use the cached value?

thanks for any help..

Re: IE 7 caching problem

Posted: Tue May 27, 2008 12:05 pm
by kaszu
As i understood, your problem is that ajax request gets cached.
Easiest solution i guess would be adding random value to the request uri

Code: Select all

var ajax_request_uri = '...?random=' + Math.random();