Uncaught ReferenceError: ActiveXObject is not defined Error in Chrome

前端 未结 3 1118
无人共我
无人共我 2021-01-12 14:03

i have this error in Chrome \"Uncaught ReferenceError: ActiveXObject is not defined \"

my code is

function loadModel() {

            //------------         


        
3条回答
  •  孤城傲影
    2021-01-12 14:48

    As stated by others, ActiveX is an IE-specific technology.

    Try this:

    if (window.DOMParser)
    { // Firefox, Chrome, Opera, etc.
        parser=new DOMParser();
        xmlDoc=parser.parseFromString(xml,"text/xml");
    }
    else // Internet Explorer
    {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async=false;
        xmlDoc.loadXML(xml); 
    } 
    

提交回复
热议问题