Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
 
PREVIOUS NEXT
Tagged: #delay #external #javascript #file #load
ADD COMMENT
Topic
Name
6+2 =