title: Spoofing referer by injecting javascript
body: <p>I've been asked a question by one of my friends as a brain teaser, is it possible to spoof a referer by injecting a link and then simulating a click? So I decided to try, I tried it with gmail.com and ran this through firebug javascript console.</p>
  
  <pre><code>var headID = document.getElementsByTagName("head")[0];         
  var newScript = document.createElement('script');
  newScript.type = 'text/javascript';
  newScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';
  headID.appendChild(newScript);
  
  $("#signIn").html('&lt;a href="http://google.com" id="testing"&gt;Hmm&lt;/a&gt;');
  $("#testing").click();
  </code></pre>
  
  <p>It's interesting tho, first I get an error because it seems that jquery is not loaded fast, but the main important thing is that the element actually doesn't get clicked, any ideas? </p>