javascript - 如何在具有 document.write 的 DIV 元素中异步加载 js 内容?
问题描述
我有jsfile.js
包含代码的js 文件
document.write('<script>..</script><style>..</style><a></a><script src".."></script>');
document.write() 中的代码实际上是一个示例网页的 html 文档,其中包含脚本、样式、元数据和所有其他可能的元素。
在没有渲染阻塞的情况下,如何在网页中加载jsfile.js
内部元素?div
我目前使用<script src="https://example.com/jsfile.js"></script>
,但它会渲染块下面的其他内容script
。
解决方案
推荐阅读
- c# - 使用相同对象生成校验和时发生更改
- java - 消费者阅读 __consumer_offsets 传递不可读的消息
- assembly - 程序如何在堆栈中找到全局变量?
- java - Java - JFrame 不显示 ImageIcon
- python - 导入时未定义枚举对象 - Python 3 通过 Jupyter Notebook
- ios - Why my does blur view become transparent when I combine with UIImagview?
- html - Angular6/Typescript - Mapping of Objects in Arrays in Arrays
- fatal-error - GuzzleHttp\Exception\RequestException' 带有消息'cURL 错误 60:(参见 http://curl.haxx.se/libcurl/c/libcurl-errors.html)
- java - Java - 将 HTML 输入类型的文件转换为 java 文件对象
- angularjs - AngularJS 在没有 ng-repeat 的情况下获取数据