Skip to content

Instantly share code, notes, and snippets.

@dyng
Created August 10, 2015 02:36
Show Gist options
  • Save dyng/40fcfeff1050f171ef04 to your computer and use it in GitHub Desktop.
Save dyng/40fcfeff1050f171ef04 to your computer and use it in GitHub Desktop.
Load javascirpt from url, note that the 'Content-Type' should be 'application/javascript'.
function loadJsFromUrl(url) {
var ele = document.createElement("script");
ele.setAttribute("src", url);
document.head.appendChild(ele);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment