我们在Safari浏览器中遇到了一个关于(createContextualFragment)
函数的问题。
我们需要向body添加一些内容,所以我们使用了这行代码。
代码:
document.getElementsByTagName('body')[0].insertBefore(document.createRange().createContextualFragment("<div></div><script src="LINK_SOURCE"></script>"), null);
这行代码在Chrome和Firefox上运行良好,但我们在Safari中使用createContextualFragment时遇到了一些问题。
Safari中的错误:
createContextualFragment — asyncronousDocumentWrite2.html:28:115NotSupportedError: DOM Exception 9:实现不支持请求的对象类型或操作。