Load Script after 10 seconds
function loadJavaScriptDynamically(url){
// Create the Script Tag
var dynamicScript = document.createElement('script');
// Set the script url, from where you have to load the js
dynamicScript.src = url;
// By default dynamic script a async in nature but I don't want this now
// If you want the then can for this async strategy
dynamicScript.async = false;
// Now lets append this script in our head tag.
document.head.appendChild(scriptTag);
};
// After loading the webpage and 10 second has been gone, this script will be loaded
setTimeout(function(){
loadJavaScriptDynamically(url , parentNode);
},10000);
// After loading the webpage and 4 second has been gone, this script will be loaded
setTimeout(function(){
loadJavaScriptDynamically(url , parentNode);
},4000);
Last updated at
Friday, Apr 24, 2020
by
Nitish Kumar Singh