How to add DOM element script to head section?

try this

var script = document.createElement('script');
script.type="text/javascript";
script.src="https://stackoverflow.com/questions/18784920/url";    

document.head.appendChild(script);

Leave a Comment