I have designed a webpage mainly consisting in JavaScript code. It has to load an XML document's content when it is loaded so as to show a content depending on the XML data.
Both the HTML file and the XML file have to be stored locally on the computer and not on a server.
I only test in Internet Explorer, and the behaviour is very strange: on some machines, the XML file in well loaded, on some machines it isn't. I haven't seen this problem happening on IE6 and sometimes it happens on IE7, sometimes not... It happens under IE7 on my Vista Virtual Machine, It does not appear on my XP with IE6 and it does appear sometimes on XP with IE7 and sometimes not..
Here is the beginning of the function I use:
Expand|Select|Wrap|Line Numbers
- function loadFromXML()
- {
- try
- {
- var request = null;
- var xmlDoc = null;
- if (window.XMLHttpRequest)
- {
- request = new XMLHttpRequest();
- }
- else if (window.ActiveXObject)
- {
- request = new ActiveXObject("Microsoft.XMLHTTP");
- }
- if (request)
- {
- request.open("GET", "commentsDatas.xml");
- request.onreadystatechange = function()
- {
- if (request.readyState == 4)
- {
- xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.loadXML(request.responseText);
- var commentsList = xmlDoc.getElementsByTagName("myComment");
If someone has an idea... I suspect that some security policy aspect is at stake but...
Thanks in advance!