动态脚本标记添加是异步的? [英] Dynamic Script Tag Addition is Asynchronous?

查看:71
本文介绍了动态脚本标记添加是异步的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

动态脚本标记添加是否异步?就像动态地包含来自不同域的一组JavaScript文件一样..

Is Dynamic Script Tag Addition is Asynchronous? Like dynamically including set of JavaScript files from a different domain..

推荐答案

是的,它是异步的。动态< script> 注入总是导致浏览器通过DOM加载外部资源(例如,就像样式表,图像,闪存),这必须异步发生以避免浏览器锁定。

Yes, it is asynchronous. Dynamic <script> injection always results in the browser loading an external resource via the DOM (e.g. just like stylesheets, images, flash), which must happen asynchronously to avoid browser lockup.

你在看 JSONP (JSON with Padding)任何机会?它使用动态脚本标记注入。关于AJAX的讨论越来越多,而且不可能同步JSONP(如同步 XmlHttpRequest )的事实经常被忽视。

Are you looking at JSONP ("JSON with Padding") by any chance? It uses dynamic script tag injection. It's more and more part of discussions about "AJAX", and the fact that it is impossible to do synchronous JSONP (like synchronous XmlHttpRequest) is often overlooked.

这篇关于动态脚本标记添加是异步的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆