1. Home
  2. Computing & Technology
  3. JavaScript
photo of Stephen Chapman
Stephen's JavaScript Blog

By Stephen Chapman, About.com Guide to JavaScript since 2004

Faster Loading Web Pages

Tuesday September 2, 2008
Web Browsers limit the number of files they download simultaneously from the one domain. When a JavaScript file is referenced from HTML the limit is reduced to ONE.

Older web browsers will only download at most two files at a time from the same domain while downloading a page into the browser. More modern browsers have increased this limit to six. This makes no difference when a <script> tag is reached in the HTML though. All browsers will stop downloading any other files while the JavaScript file is downloaded and run. The reason behind this logic is that the JavaScript code when run may generate a result that means that the rest of the page doesn't need to be downloaded (such as if it sets a new location value).

We can significantly speed the loading of our web pages if we get rid of this single threading of JavaScript files. The limit only applies to file downloads triggered by HTML. If we trigger the JavaScript downloads from JavaScript then they will be carried out totally separately from the HTML requests allowing the JavaScript to be downloaded simultyaneously with (or after) the rest of the web page.

Faster Loading Web Pages
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.