javascript add script in head programmatically code example
Example: javascript add script in head programmatically
var my_awesome_script = document.createElement('script');
my_awesome_script.setAttribute('src','http://example.com/site.js');
document.head.appendChild(my_awesome_script);