Estoy escribiendo una aplicación y estoy intentando vincular la funcionalidad simple de AJAX. Funciona bien en Mozilla Firefox, pero hay un error interesante en Internet Explorer: cada uno de los enlaces puede solo haga clic una vez. El navegador debe reiniciarse completamente; simplemente, volver a cargar la página no funcionará. Escribí un very simple example application que demuestra esto.Internet Explorer 7 enlaces Ajax solo cargan una vez
Javascript reproduce a continuación:
var xmlHttp = new XMLHttpRequest();
/*
item: the object clicked on
type: the type of action to perform (one of 'image','text' or 'blurb'
*/
function select(item,type)
{
//Deselect the previously selected 'selected' object
if(document.getElementById('selected')!=null)
{
document.getElementById('selected').id = '';
}
//reselect the new selcted object
item.id = 'selected';
//get the appropriate page
if(type=='image')
xmlHttp.open("GET","image.php");
else if (type=='text')
xmlHttp.open("GET","textbox.php");
else if(type=='blurb')
xmlHttp.open("GET","blurb.php");
xmlHttp.send(null);
xmlHttp.onreadystatechange = catchResponse;
return false;
}
function catchResponse()
{
if(xmlHttp.readyState == 4)
{
document.getElementById("page").innerHTML=xmlHttp.responseText;
}
return false;
}
Cualquier ayuda sería muy apreciada.
En mi experiencia, añadiendo los tres los encabezados que publiqué arriba evitarán que IE se almacene en caché, sin la necesidad de agregar un número aleatorio. – pkaeding