Is dynamic Script tag addition asynchronous?
Yes. It is considered asynchronous mainly because of what happens when the Script tag is not dynamically inserted.
A fully-formed Script tag that exists in the DOM will lead to blocking behavior, that is, the page will not be able to continue loading other HTML until this particular asset finishes loading. Thus, many developers prefer to place Script tags immediately before the </body> . So the tag is called synchronous .
In contrast, if you dynamically insert a Script tag, it does not show blocking. I say because, as you saw in other comments, not all browsers do this. It is best to wrap this dynamic Script code in some document ready callback. Thus, on the contrary, it is technically asynchronous , because other assets can continue to function along with this asset and its functionality.
source share