javascript - Is there a cross browser way to set a timeout on Third Party (cross domain) Async Dom Injected Scripts? -
Our tag manager went down today, from which our site was crawled to an attack. As the code mission manager in the tag manager is not critical (analytics, etc ...), is there any way to do something like that?
var extScript = document.createElement ('script'); ExtScript.type = 'text / javascript'; Extcript.src = 'http://third-party.com/scriptfile.js'; Var s = document.getElementsByTagName ('script') [0]; S.parentNode.insertBefore (extScript, s); Window.setTimeout (function () {// script is not loaded - "necklace"}, 3000); // 3 sec
If this mission is not important, then you want to keep it The script is loaded at the end of the body tag, as soon as the document is fully loaded.
window.onload = function () {var extScript = document.createElement ('script'); ExtScript.type = 'text / javascript'; Extcript.src = 'http://third-party.com/scriptfile.js'; Document.body.appendChild (extScript); }
Comments
Post a Comment