I used this as a starting point, but realize it depend upon a div being present.
Curious as to wether or not I can just use appendChild
to append the script directly to document.body?
// loads a script using the DOM and an optional argument to bust the cache
function loadScript(path, bust) {
console.log("Loading | " + path + " | " + bust)
const ref = document.getElementsByTagName( 'div' )[ 0 ];
const script = document.createElement( 'script' );
if(bust){
path = path + '?cache_buster=' + bust;
}
script.src = path;
ref.parentNode.insertBefore( script, ref );
}