Create script tag in IE8

前端 未结 1 355
既然无缘
既然无缘 2021-01-01 17:57

I was testing our site, in IE8 and got the dreaded Unexpected call to method or property access. error.

After lots of debugging (IE8\'s devtools suck),

相关标签:
1条回答
  • 2021-01-01 18:13

    Your javascript only method needs to add the script element to the document.

    IE<9 does not recognize innerHTML or childNodes on script tags, but all browsers support the text property.

    var scriptTag = document.createElement('script');
    scriptTag.text= JSData;
    document.body.appendChild(scriptTag);
    
    0 讨论(0)
提交回复
热议问题