百度地图开发:阻塞加载慢A parser-blocking, cross site的解决方案_javascript


api?v=2.0&ak=11Z8uiP8kIz6AG0Vjiwzbc5f9Ii0cdHd:1 A parser-blocking, cross site (i.e. different eTLD+1) script, http://api.map.baidu.com/getscript?v=2.0&ak=11Z8uiP8kIz6AG0Vjiwzbc5f9Ii0cdHd&services=&t=20210918100012, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.



译文:
通过document.write调用。由于网络连接不良,浏览器可能会在本次或将来的页面加载中阻止对此脚本的网络请求。如果在此页面加载中被阻止,将在后续控制台消息中确认。


解决方案:

<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={$bdKey}"></script>

修改为:

<script type="text/javascript" src="http://api.map.baidu.com/getscript?v=2.0&ak={$bdKey}"></script>

Lockdatav Done!