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