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

前端 未结 7 1047
星月不相逢
星月不相逢 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:40

    The problem with loading a script on a already loaded document (instead of having the browser ignore the document.write()) is that you would delete all existent HTML. See this example so you can understand exactly what's happening, or for more details look at a documentation page for the document.write() method.

    While I know this might not be what you're expecting to get as an answer, I believe you are out of luck since rewriting the script is not an option.

    This appears to be a similar question with similar replies.

提交回复
热议问题