JavaScript: How to download JS asynchronously?

Posted by Teddyk on Stack Overflow See other posts from Stack Overflow or by Teddyk
Published on 2010-05-10T14:18:40Z Indexed on 2010/05/10 14:24 UTC
Read the original article Hit count: 180

Filed under:
|

On my web site, I'm trying to accomplishes the fastest page load as possible.

I've noticed that it appears my JavaScript are not loading asynchronously. Picture linked below.

image

How my web site works is that it needs to load two external JavaScript files:

  • Google Maps v3 JavaScript, and
  • JQuery JavaScript

Once it loads these external javascript files, it then, and only then, can dynamically render the page. The reason why my page can't load until both Google Maps and JQuery are loaded is that - my page, based on the geolocation (using Gmaps) of the user will then display the page based on where they are located (e.g. New York, San Francisco, etc). Meaning, two people in different cities viewing my site will see different frontpages.

Question: How can I get my JavaScript files to download asynchronously so that my overall page load time is quicker?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about web-development