Solution to Ajax Cache problem with Internet Explorer
This thread belongs to

2007-03-27 22:55 GMT   |   #1

Hi ,
If you are facing a problem with caching in internet explorer and your ajax application .

You can add the following code in your jsp file :

response.setHeader("Cache-Control", "no-cache");

and in your javascript url
    var url="UI/RoomDetailsView.jsp?ignoreMe=" + new Date().getTime();

Or in php
<?php 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("Pragma: no-cache");  

have fun, :n_clap:
2009-02-10 00:28 GMT   |   #2

hi! is this code working? where in particular can i apply the javascript url and the response.setHeader("Cache-Control", "no-cache")?

thank you.. this is my ajax code by the way, maybe you can help me out here where to put the code since i am still a newbie for ajax.

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest)

XMLHttpRequestObject = new XMLHttpRequest();

else if (window.ActiveXObject)
XMLHttpRequestObject = new

function getData(dataSource, divID)
if(XMLHttpRequestObject) {

var obj = document.getElementById(divID);"GET", dataSource, true);

XMLHttpRequestObject.onreadystatechange = function()
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {

obj.innerHTML = XMLHttpRequestObject.responseText;