Last active
February 8, 2017 06:47
-
-
Save Danilovonline/eeca0f0306def729de0b603c84e457f6 to your computer and use it in GitHub Desktop.
Dynamic load JS file
This file contains 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 s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0]; | |
s1.async=true; | |
var scheme = (document.location.href.indexOf('https://') === 0) ? 'https://' : 'http://'; | |
s1.src = scheme + 'example.com/example.js'; | |
s1.charset="UTF-8"; | |
//s1.crossorigin="anonymous"; | |
s0.parentNode.insertBefore(s1,s0); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment