Voici le code :
Fonctionne très bien sous IE, mais pas sous FireFox 2.0
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <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
Partager