Home  >  Article  >  Web Front-end  >  异步加载script的代码_javascript技巧

异步加载script的代码_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:12:001083browse

通过iframe 异步加载script
通过异步请求另一页面的script 是不执行的,只返回html 原文件,因为返回的文本没有经过浏览器的解析执行。
看代码
a1.html

复制代码 代码如下:



无标题页








a2.html
复制代码 代码如下:



无标题页


<script> <BR>alert('我是异步script'); <BR></script>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn