<script>
document.querySelector( 'html' ).innerHTML += 'hello';
</script>
<script>
document.querySelector( 'script' ).innerHTML += 'alert( "world?" )';
</script>
The alert()
function does not fire on page load. This is an overly simplified example but the desired result is to inject additional JavaScript code into a script
tag after the page has loaded.
How can this code be altered so that the alert
function properly fires in the browser?