Why does this work when run in Chrome's Developer Tools (Console Tab):
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src ='somescript.js';
$0.appendChild(script);
but this not work when added as a string using the Edit As HTML feature in Chrome's Developer Tools (Elements tab, editing body
tag):
<script type="text/javascript" src="somescript.js"></script>
?
Contents of somescript.js
:
console.log('some js is being run');
Defintion of "work" in this case:
some js is being run
is printed as console output