Here is the JavaScript code I inject into the page:
javascript:{document.head.innerHTML+='<script>function inject(){alert(hello);}</script>';
document.body.innerHTML+='<button onclick=inject()>Run</button>';}
After running this code in the URL bar, I inspect the source code of the website. Both the button and the function definition are present, however pressing the button does not run the alert as one would expect.
What could be the problem?