Created
August 23, 2011 01:55
-
-
Save subtleGradient/1164132 to your computer and use it in GitHub Desktop.
Safe loadAsyncScript implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loadAsyncScript(URL) { | |
| var script = document.createElement('script'), | |
| firstScript = document.getElementsByTagName('script')[0]; | |
| script.async = 1; | |
| script.src = URL; | |
| firstScript.parentNode.insertBefore(script, firstScript); | |
| } | |
| loadAsyncScript('ext.js'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment