Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 602213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:47:53+00:00 2026-05-13T16:47:53+00:00

given I asynchronously(!!) load several JavaScript files with an asynchronous script loader (that writes

  • 0

given I asynchronously(!!) load several JavaScript files with an asynchronous script loader (that writes a script tag into the document’s head that then will download the file), are these scripts evaluated in parallel?

<script>
 var script = document.createElement('script');
 script.src = "library1.js";
 document.getElementsByTagName('head')[0].appendChild(script); 
</script>
 <!-- Other Markup -->
<script>
 var script = document.createElement('script');
 script.src = "library2.js";
 document.getElementsByTagName('head')[0].appendChild(script); 
</script>
<!-- Other Markup -->
<script>
 var script = document.createElement('script');
 script.src = "library3.js";
 document.getElementsByTagName('head')[0].appendChild(script); 
</script>

“Normally”, when having a standard script tag in the HTML document (body and head!?) the browser will stop/complete all other activites (downloading/page rendering) and only process the single script tag that it encountered. This leads to a “serialized” execution that does not lead to any “race conditions”.

But by using the asynchronous loader technique, will the inserted script tag (in the head) also lead (in the end) to a serialized rendering (that when downloaded) only “the current” script will be evaluated or is there the chance that other asynchronously loaded script files will be evaluated in parallel and therefor are prone to race conditions?

Thank you very much!!
Tim

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:47:53+00:00Added an answer on May 13, 2026 at 4:47 pm

    Although scripts will be downloaded in parallel, the order in which they are executed is not deterministic. IE will execute them in the order they finish downloading in, whereas Firefox executes them in the order they are attached in the DOM.

    This is a problem. For example, say script A and script B are added using that technique. Now imagine script A is jQuery, and script B does this:

    $(document).ready(function(){...})
    

    In IE you’re screwed if for whatever reason (eg, network traffic, cache miss) script B finishes downloading before script A, because it will be executed before jQuery has been loaded.

    See this article for a better explanation.

    As for a solution, you can instead place the <script> elements as far down the page as possible (eg before the closing </body> element. Although this does not guarantee parallel downloads, it does help alleviate the “blocking” problem your solution is addressing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 304k
  • Answers 304k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It should be easy ;) ProgressBar pb = (ProgressBar)((View)list.getChildAt(i)).findViewById(R.id. downloadprogress); May 13, 2026 at 8:45 pm
  • Editorial Team
    Editorial Team added an answer <c:out value="${myString}"/> One way of having myString available is by… May 13, 2026 at 8:45 pm
  • Editorial Team
    Editorial Team added an answer Try this instead: UIGraphicsBeginImageContext(kSBCanvas.bounds.size); { [kSBCanvas.layer renderInContext: UIGraphicsGetCurrentContext()]; UIImage *theImage… May 13, 2026 at 8:45 pm

Related Questions

I currently have a tomcat container -- servlet running on it listening for requests.
Problem: I want to implement several php-worker processes who are listening on a MQ-server
I'm using objective-c & the iphone 3.0 sdk I want to retrieve the contents
I'm new to Java and I need some advice/information on how to debug my
I'm in the design stage for an app which will utilize a REST web

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.