Delay loading JS Files


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. loadExternalJScript : function(scriptURL, id){
  2. var script = document.createElement('script');
  3. script.src = scriptURL;
  4. script.id = id;
  5. script.type = 'text/javascript';
  6. script.charset = 'utf-8';
  7. // Add the script to the head, upon which it will load and execute.
  8. var head = document.getElementsByTagName('head')[0];
  9. head.appendChild(script);
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.