Dynamic Script Tag Addition is Asynchronous?

javascript

Solution

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.

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.

Problem

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

Original source

Related problems