How to load third-party javascript tag asynchronously which has [removed]

前端 未结 7 1087
星月不相逢
星月不相逢 2021-01-04 07:16

We give out a piece of javascript tags such as which site owners put on their site like http://exa

7条回答
  •  没有蜡笔的小新
    2021-01-04 07:26

    Yes, document.write can't be called from an asynchronously loaded script, because it's detached from the document, so it can't write to it.

    You can see the approach used here for the google maps api to get around this problem. So, it is possible some of your 3rd party scripts that you haven't named, could have the similar callback pattern implemented.

    https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=EN

    
    
      
        Simple Map
        
        
        
      
      
        

提交回复
热议问题