<script> function downloadJSAtOnload(){ var elem = document.createElement("script"); elem.src="defer.js"; document.body.appendChild(elem); }; if(window.addEventListener){ window.addEventListener("load",downloadJSAtOnload,false); }else if(window.attachEvent){ window.attachEvent("onload",downloadJSAtOnload); }else{ window.onload = downloadJSAtOnload; }; </script>