[AJAX] différence FF et IE cache ?
Bonjour , voici le code ma page HTML appelant une servlet en Asynchrone (AJAX) , je l'ai placé ici car je pense que cela vient du javascript.
"L'application" a un comportement différent dans IE et FF.
J'ai même l'impression que c'est une histoire de cache.
Dans le cas de FireFox , tout marche bien.
Dans le cas de IE , la Servlet renvoie toujours le même code.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PDA</title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function DetecteToucheEntree(evenement)
{
var touche = window.event ? evenement.keyCode : evenement.which;
if (13 == touche){
return ajaxFunction();
}
}
function setDefaultFocus(){
document.getElementById('ticketId').focus();
}
function getXMLObject() //XML OBJECT
{
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP") // For Old Microsoft Browsers
}
catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") // For Microsoft IE 6.0+
}
catch (e2) {
xmlHttp = false // No Browser accepts the XMLHTTP Object then false
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
}
return xmlHttp; // Mandatory Statement returning the ajax object created
}
var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object
function ajaxFunction() {
var ticketId = document.getElementById("ticketId").value; //Used to prevent caching during ajax call
if(xmlhttp) {
xmlhttp.open("GET","HandleRemi?ticketId="+ticketId ,true); //gettime will be the servlet name
xmlhttp.onreadystatechange = handleServerResponse;
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(null);
}
}
function handleServerResponse() {
if (xmlhttp.readyState == 4) {
document.getElementById("div").innerHTML = xmlhttp.responseText; //Update the HTML Form element
document.getElementById("ticketId").value= '';
}
}
function initRequest() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
isIE = true;
return new ActiveXObject("Microsoft.XMLHTTP");
}
}
</script>
</head>
<body onload="javascript:setDefaultFocus();">
<h1><img src="images/Roland_garros_logo.png" width="10%" height="10%" /></h1>
<p>Ticket:
<input name="ticketId" id ="ticketId" type="text" STYLE="color:#000000;background-color:#FFFFFF" onkeyPress="return DetecteToucheEntree(event)" />
<div id="div"></div>
<div id="debug"></div>
<br/>derniere modif 15.32 le 21 avril
</p>
</body>
</html> |