title: How to inject JavaScript into a website through the URL bar?
body: <p>Here is the JavaScript code I inject into the page:</p>
  
  <pre class="lang-js prettyprint-override"><code>javascript:{document.head.innerHTML+='&lt;script&gt;function inject(){alert("hello");}&lt;/script&gt;';
  document.body.innerHTML+='&lt;button onclick="inject()"&gt;Run&lt;/button&gt;';}
  </code></pre>
  
  <p>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.</p>
  
  <p>What could be the problem?</p>