Internet Explorer 11(IE 11)使用DOMParser中的parseFromString引发语法错误 [英] Internet Explorer 11 (IE 11) Throws Syntax Error using parseFromString in DOMParser
本文介绍了Internet Explorer 11(IE 11)使用DOMParser中的parseFromString引发语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if(window.DOMParser)
{
parser = new DOMParser();
tmp = parser.parseFromString(resp,text / xml);
}
我可以解决这个问题吗?
解决方案
对于IE,这适用于我
xmlDoc = new的ActiveXObject( Microsoft.XMLDOM);
xmlDoc.async = false;
xmlDoc.loadXML(text);
来源: http://www.w3schools.com/dom/dom_parser.asp
I have some Javascript on a webpage which works fine in Chrome and Firefox; when testing in IE 11 however it fails. I viewed the problem in IE 11 with the debug tools (F12) and the following code was at fault; specifically when using parseFromString a 'Syntax Error' is thrown:
if (window.DOMParser)
{
parser = new DOMParser();
tmp = parser.parseFromString(resp, "text/xml");
}
Any way I can work around this?
解决方案
For IE this works for me
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(text);
source: http://www.w3schools.com/dom/dom_parser.asp
这篇关于Internet Explorer 11(IE 11)使用DOMParser中的parseFromString引发语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文