var my_awesome_script = document.createElement('script');
my_awesome_script.setAttribute('src','http://example.com/site.js');
document.head.appendChild(my_awesome_script);
More Related Contents:
- What are alternatives to document.write?
- Programmatically change the src of an img tag
- Changing iframe src with Javascript
- Execute write on doc: It isn’t possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
- Pass vars to JavaScript via the SRC attribute
- Javascript set img src
- What is my script src URL?
- document.write() overwriting the document?
- What is the correct way to write HTML using Javascript?
- Change image source with JavaScript
- How to get the file-path of the currently executing javascript code
- Javascript : get src and set as variable?
- Why won’t this JavaScript (using document.open and document.write) work in Internet Explorer or Opera?
- How do I add something to my html using javascript without erasing the whole page
- Add transition while changing img src with javascript
- JavaScript – Get size in bytes from HTML img src
- Print / display a JavaScript variable’s name instead of it’s value
- JavaScript – controlling the insertion point for document.write
- Why would a JavaScript variable start with a dollar sign? [duplicate]
- Global variables in Javascript across multiple files
- HTML5 audio streaming: precisely measure latency?
- How to smoothly scroll to an element in pure JavaScript
- Understanding Javascript immutable variable
- Backbone.js fetch with parameters
- What does the “$” sign mean in jQuery or JavaScript? [duplicate]
- How can I save information locally in my chrome extension?
- Webpack not excluding node_modules
- How to convert array of key–value objects to array of objects with a single property?
- Count console.log objects
- Why do these two javascript 2d-arrays behave differently?