Cut string obtained with Javascript inside hyperlink
<p>I made a bookmark that users can add and it sends them to my site capturing the referrer. </p>

<pre><code>&lt;a href="javascript:location='http://www.chusmix.com/tests/?ref='+escape(location.href);" onclick="alert('Drag it, not click it!');return false;"&gt; Bookmark &lt;/a&gt;
</code></pre>

<p>My problem is that for some reason the location.href part instead of printing http:// it prints: "http%3A//". I want to remove it and get just the domain.com</p>

<p>I have a similar code that maybe could be useful but I'm having a hard time figuring out how to implement it inside HTML.</p>

<pre><code>// Function to clean url

    function cleanURL(url)
    {
        if(url.match(/http:\/\//))
        {
            url = url.substring(7);
        }
        if(url.match(/^www\./))
        {
            url = url.substring(4);
        }

        url = "www.chusmix.com/tests/?ref=www." + url;

        return url;
    }
    &lt;/script&gt;
</code></pre>

<p>Thanks</p>
