delay external javascript file load code example
Example: delay external javascript file load
//load external js file into header after 2 seconds
setTimeout(function() {
var headerEl = document.getElementsByTagName("head")[0];
var scriptEl = document.createElement('script');
scriptEl.type = 'text/javascript';
scriptEl.src = 'http:/www.mywebsite.com/myscript.js';
headerEl.appendChild(scriptEl);
}, 2000);