var th = document.getElementsByTagName(pos);
var s = document.createElement(‘script’);
the variable pos is the tag where you want to add the file
An example of usage:
It works for me, I hope for you too!