appendChild()
is a more native way:
var script = document.createElement('script');
script.type="text/javascript";
script.src="https://stackoverflow.com/questions/5282228/script.js";
document.head.appendChild(script);
More Related Contents:
- Colors in JavaScript console
- Console.log showing only the updated version of the object printed
- What’s the difference between console.dir and console.log?
- clear javascript console in Google Chrome
- TypeError: Illegal Invocation on console.log.apply
- How to make Google Chrome JavaScript console persistent?
- How do I print debug messages in the Google Chrome JavaScript Console?
- Chrome JavaScript developer console: Is it possible to call console.log() without a newline?
- Create shortcut to console.log() in Chrome
- How to get result of console.trace() as string in javascript with chrome or firefox?
- Official locator strategies for the webdriver
- Use a content script to access the page context variables and functions
- Suppress Chrome ‘Failed to load resource’ messages in console
- Jquery load() only working in firefox?
- Chrome Uncaught Syntax Error: Unexpected Token ILLEGAL [duplicate]
- Get element CSS property (width/height) value as it was set (in percent/em/px/etc)
- What is the correct syntax of ng-include?
- Unexpected token ILLEGAL in webkit
- “Origin null is not allowed by Access-Control-Allow-Origin” in Chrome. Why? [duplicate]
- How to give a Blob uploaded as FormData a file name?
- Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114
- How do I get console input in spidermonkey JavaScript?
- Detect left mouse button press
- Stop Chrome Caching My JS Files
- Force hide address bar in Chrome on Android
- CreateTextRange is not working in Chrome
- AngularJS ng-include inside of Google Maps InfoWindow?
- chrome Pop-up blocker when to re-check after allowing page
- Cross-domain XMLHttpRequest using background pages
- XMLHttpRequest; Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource [duplicate]