Monday, June 3, 2024
38
rated 0 times [  45] [ 7]  / answers: 1 / hits: 25296  / 12 Years ago, mon, august 27, 2012, 12:00:00

I am having some JavaScript issues that seem to only occur in Internet Explorer 10 on Windows 8 (IE 7, 8, and 9 all work fine). The basic jist of what I am doing is getting XML and XSL from a web service and then transforming them in JavaScript to render on the page using the Sys.Net.XMLDOM object.



XMLDOM = Sys.Net.XMLDOM;

var xsl = // XSL gotten from somewhere else
var xmlString = // XML gotten from somewhere else as a string...
var xml = new XMLDOM(xmlString);

var content = xml.transformNode(xsl);


When I use the above code in IE 10, I get:




Object doesn't support property or method 'transformNode'




Any ideas on why Internet Explorer 10 is doing this?



EDIT



I have also tried this:



xmldoc = new ActiveXObject(Msxml2.DOMDocument); 
xmldoc.async = false;
xmldoc.load(xml);

xsldoc = new ActiveXObject(Msxml2.DOMDocument);
xsldoc.async = false;
xsldoc.load(xsl);

var content = xmldoc.transformNode(xsldoc);


Which works in all previous versions of IE, but in IE 10 I get:




Reference to undeclared namespace prefix: 'atom'.



More From » internet-explorer-10

 Answers
14

Found the answer: http://blogs.msdn.com/b/ie/archive/2012/07/19/xmlhttprequest-responsexml-in-ie10-release-preview.aspx



IE 10 requires using an XMLHttpRequest with the responseType set as msxml-document. Once I switched the code over to that, everything works perfectly in all browsers:



if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else {
xhr = new ActiveXObject(Microsoft.XMLHTTP); // For IE 6
}
xhr.open(GET, url, false);
try { xhr.responseType = msxml-document; } catch (e) { };
xhr.send();

[#83393] Sunday, August 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
koltonadolfow

Total Points: 71
Total Questions: 118
Total Answers: 102

Location: Vietnam
Member since Sun, Oct 18, 2020
4 Years ago
;