How to Load External JavaScript Asynchronously or Dynamically
JavaScript makes more easier to manipulate websites, now a days most of the browsers supporting JavaScript codes. When the HTML parser encounters a <script> element, by default, run the script before it can parsing and rendering the document. It is not much problem for inline scripts but if the script source code is in an external file specified with a src attribute, the portions of the document that follow the Script will not appear in the browser until the script has been downloaded and executed.This makes loading of the website much slower, which makes bad user experience for your website and may not also indexing of your website by the search engines. This Synchronous or blocking script execution is the default only. The <script> tag can have defer and async attributes, which cause scripts to be executed differently. This makes your website loading much faster than before and appears contents of your site by loading at first. Loading JavaScript Asynchronously using as...