After watching some very stimulating google tech talks on YouTube, I walked away with some new insight on how browsers load content. The following is a technique I picked up that allows for all included javascripts to load in parallel (instead of sequentially), and to prioritize the loading of your visible page content first.
The following code is placed before the closing body tag (and not in the head, as is traditionally done).
<script type="text/javascript"> var DocumentHead = document.getElementsByTagName('head')[0]; function jsOptimizedLoader(src) { var Script = document.createElement('script'); Script.src = src; Script.type = 'text/javascript'; DocumentHead.appendChild(Script); } jsOptimizedLoader('js/app/foo.js'); jsOptimizedLoader('js/app/bar.js'); jsOptimizedLoader('js/app/boo.js'); jsOptimizedLoader('js/app/far.js'); </script>
Once your DOM has finished loading, all the scripts tags are added to the head via javascript. Allowing your page to display PRIOR to spending the time loading all of those scripts will win you usability points and ease of access points with your audience.
