function dynamicallyLoadScriptIn(url, document) { var script = document.createElement("script"); script.src = url; document.head.appendChild(script); } console.log("parent: " + parent); console.log("parent location: " + parent.document.location); dynamicallyLoadScriptIn("https://code.jquery.com/jquery-1.10.2.js", parent.document); dynamicallyLoadScriptIn("https://botcompany.de/1028422/raw?rand=" + Math.random(), parent.document); console.log("loaded scripts");