I am going to put together a program to parse an xml file using Javascript and am having problems with IE. Other browsers are fine with the start below, but IE7 is giving me the error “Access is denied” on the line starting with xmlHttp.open. IE6 is fine, and IE8 is not displaying the document.write text, so I am assuming that the error displayed in IE7 is happening.
The code I am using is below.
[INDENT][FONT=”Courier New”]<html>
<body>
<script type=”text/javascript”>
var xmlHttp = false;
try {
xmlHttp = new XMLHttpRequest();
} catch (TryMicrosoft) {
try {
xmlHttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch (TryOtherMicrosoft) {
try {
xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch (ItFailed) {
xmlHttp = false;
}
}
}
xmlHttp.open(“GET”,”test.xml”,false);
xmlHttp.send(“”);
xmlDoc = xmlHttp.responseXML;
document.write(“Document loaded.”);
</script>
</body>
</html>[/FONT][/INDENT]
I am using IE Tester for my testing of IE.
Am I doing something wrong that is not allowing this work in IE or is it a browser setting? If it is the latter then I will not be able to write the routine, as it would not be appropriate to ask a visitor to change a setting just to be able to run the page. I’m thinking that there must be some way of doing this so that IE doesn’t get in the way.
Thanks for the help.
george