Sulla rete ho trovato questo script


codice:
function ahah(url, target) {

          document.getElementById(target).innerHTML = 'caricamento dati in corso...';
          if (window.XMLHttpRequest) {
                req = new XMLHttpRequest();
          } else if (window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
          }
          if (req) {
                req.onreadystatechange = function() {
                        ahahDone(url, target);
                };
                req.open("GET", url, true);
                req.send("");

  }

}

function ahahDone(url, target) {
  if (req.readyState == 4) {
    if (req.status == 200) {
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML="ahah error:\n"+req.statusText;
    }
  }
}
che sembra fare bene il suo lavoro, però se provo a far si che lo stesso venga richiamato in un certo intervallo di tempo, prima o poi ricevo un errore di memoria esaurita. Ora quello che mi è venuto in mente è che le richieste possono sovrapporsi più velocemente di quanto vengano eseguite, e che è inutile caricare di nuovo la pagina se non è stata modificata nel frattempo.

Quello di cui ho bisogno è uno script che faccia aggiornare la pagina solo se il file della chat è stato effettivamente modificato. Oppure, se ne conoscete, qualche soluzione più efficiente