Showing posts with label async. Show all posts
Showing posts with label async. Show all posts

Wednesday, 2 May 2012

JavaScript: asynchronous loading

   


JavaScript is an important part of web developing. We heavily rely on JavaScript library and more than often we use external reference to load js snippets. In order to link an external js file we usually insert the following code where needed:
<script src="http://externalDomain.com/script.js"></script>
If the externalDomain is someway busy or down, our page will hang, waiting for the externalDomain. The page will eventually be loaded and displayed when the resource becomes free. Worst case scenario: the externalDomain stays busy and our page stays completely blank.
There's a solution to the above issue: using asynchronous loading and here I show you how to use it.