htmlreferencereferrerrel

Link Referrer in HTML


I want to ask a quetion about rel property of a tag in HTML (actually, HTML5 if that will make any difference)

I'll continue with example domain names. My website is example.com. I've a link to this page at example2.com. If I give this link with something like

<a href="example.com" referrer="referrer.com">Click me</a>

will my referrer be referrer.com or example2.com? BTW is there anything possible like that code? Giving a random referrer?

2nd one, because I think subjects are similar.

Long story short, I want to hide and/or change the referrer.


Solution

  • I believe that a meta refresh does not leave a trace of a referrer <meta http-equiv="refresh" content="0; url=http://www.example.com"> The thing here though, is getting it from an onclick (a) element, so you should, AFAIK, be able to do something like:

    <a onclick="mask('http://www.example.com/')">Click me</a>
    
    function mask(url) {
        var meta = document.createElement("meta");
        meta.setAttribute("http-equiv", "refresh");
        meta.setAttribute("content", "0; url=" + url);
    }
    

    Disclaimer: untested