getting href onclick
<p>I am developing an extension for Mozilla Firefox. A main function is to get the URL that the user is visiting and process it later. I tried the following Javascript code:</p>

<pre><code>window.onload = function(){
  alert(document.referrer);
}
</code></pre>

<p>That didnt work so I tried to inject an <code>onclick</code> event to every link using this:</p>

<pre><code>window.onload = function(){ 
    var links = document.links;
    for(var i=0;i&lt;links.length;++i){  
        links[i].onclick = show_href();
    }
}

function show_href(){
    alert(this.href);    
}
</code></pre>

<p>But that also doesnt work. Any other approach?</p>
