Created
August 28, 2013 17:34
-
-
Save siriokun/6368836 to your computer and use it in GitHub Desktop.
Append Javascript to head tag in HTML, so it not blocking rendering.
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(){ | |
var yourscript = document.createElement('script'); | |
yourscript.type = 'text/javascript'; | |
yourscript.async = true; | |
yourscript.src = 'http://domain.tld/path/to.js'; | |
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(yourscript); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment