wootscootinboogie
wootscootinboogie

Reputation: 8705

Execution of dynamically loaded JavaScript

Let's say depending on some condition your application dynamically fetches some script. Is that action synchronous and blocking, e.g. any ongoing rendering of HTML stops, or is it done asynchrounously?

Upvotes: 1

Views: 58

Answers (1)

jfriend00
jfriend00

Reputation: 708116

The dynamically loading of the script would normally be asynchronous (via Ajax or a <script> tag). The execution of the script after it loads would be synchronous just like any other running script.

It is possible to run blocking Ajax calls to load it (though generally considered a bad idea), but I assume you're not doing that so using a normal Ajax call or a <script> tag would be async for loading.

Upvotes: 2

Related Questions