Firefox 2.0 ne reconnaît plus xmlHttpRequest ?
Publié : 07 nov. 2006, 13:02
Voici le code :
Fonctionne très bien sous IE, mais pas sous FireFox 2.0
Erreur javascript sous FireFox 2.0 : uncaught exception: Permission refusée d'appeler la méthode XMLHttpRequest.open
Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0
Code : Tout sélectionner
<html>
<head>
<title tal:content="template/title">The title</title>
<script language='javascript' type='text/javascript'>
var xmlHttp = false;
init();
function init(){
/* Create a new XMLHttpRequest object to talk to the Web server */
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
xmlHttp = new XMLHttpRequest();
}
}
function callServer() {
if (xmlHttp.readyState!=0)
{
xmlHttp.onreadystatechange = function() {};
xmlHttp.abort();
xmlHttp = false;
init();
}
// Build the URL to connect to
var url = "http://localhost/wnl/subscribe.php";
// Open a connection to the server
xmlHttp.open("GET", url, true);
// Setup a function for the server to run when it's done
xmlHttp.onreadystatechange = updatePage;
// Send the request
xmlHttp.send(null);
}
function updatePage() {
if (xmlHttp.readyState == 4) {
response = xmlHttp.responseText;
document.getElementById("message").innerHTML = '';
document.getElementById("appli").innerHTML = response;
if (response=='') document.getElementById("appli").innerHTML = '<br><br>Aucun resultat.';
}
}
</script>
</head>
<body>
<span id="message">loading...</span>
<div id="appli"></div>
<img src="Zeuro/Image/Verif" onload="callServer()" />
</body>
</html>
Erreur javascript sous FireFox 2.0 : uncaught exception: Permission refusée d'appeler la méthode XMLHttpRequest.open
Message envoyé avec : Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0