Asynchronous Loading of External Javascript
INTRODUCTION Loading of external javascript resources (libraries, plugins, widgets) should be done asynchronously, in a non-blocking manner, so the load time of your web-page will not be affected. Thus other resources like images and CSS are not blocked from loading. HTML5 WAY In the past that was possible with help of thedefer attribute, later HTML5 spec introduce the async attribute. <script src="//code.jquery.com/jquery-1.11.0.min.js" async> </script> PROGRAMATICALLY WAY Dynamically you can create script tag and inject it into the DOM. <script type="text/javascript"> (function() { var script = document.createElement("script"); script.type = "text/javascript"; script.async = true; script.src = "//code.jquery.com/jquery-1.11.0.min.js"; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script); })(); </script>