javascript – 通过document.write调用一个Parser-blocking,cross-origin脚本 – 如何规避它?
作者:互联网
谷歌浏览器开始在慢速网络上实施Blocking the load of cross-origin, parser-blocking scripts inserted via document.write in the main frame,这会导致以下错误:
A Parser-blocking, cross-origin script, 07001, is invoked via document.write. This may be blocked by the browser if the device has poor network connectivity.
但是,我的网页需要使用document.write(‘< script src =“...”>< / script>‘)同步加载第三方脚本.如何规避封锁?
更多关于这种变化:
> Design document
> Longer document
> Web Incubator CG issue
> Chrome Issue
解决方法:
根据Google Developers article,您可以:
>使用异步脚本加载,使用< script src =“...”async>或element.appendChild(),
> Submit the script provider to Google for whitelisting.
标签:document-write,javascript,google-chrome 来源: https://codeday.me/bug/20191003/1850131.html