Royal
Royal

Reputation: 287

How can i remove the http header referer informations(saved by browser) using javascript?

For example, there is a "Link" called go to view at the bottom of the my page, which is redirecting to http://localhost/test.php.

If we use $_SERVER['HTTP_REFERER'] in test.php page it will display the url of the page from which link was clicked.

The problem is this: my URL can be seen at the target page. This needs to be avoided. How can i do this using javascript?

Upvotes: 0

Views: 723

Answers (3)

Alan
Alan

Reputation: 652

Check http://www.referhush.com/

As sentence on this site says :"Webmasters can use this tool to prevent their site from appearing in the server logs of referred pages as referrer."

Upvotes: 0

vbence
vbence

Reputation: 20333

There is no cross-browser solution. For example this code works in Chrome, but not in FF:

<a href="reftarget.php">classic html link</a><br/>
<a href="javascript:goto('reftarget.php')">js trickery</a>
<script>

function goto(url) {
    var frame = document.createElement("iframe");
    frame.style.display = "none";
    document.body.appendChild(frame);
    frame.contentWindow.location.href="javascript:top.location.href = '" + url + "';";
}

</script>

There are third party solutions. You can find any number of them by searching "referer hide" or "refer mask" with you favorite search engine. - Some of them look sady, so try to find a trustworty one.

On the other hand. This is part of Internet culture. Referers can be used for valuable statistics for example. And if your website is in a crawler's index, they can find the link anyway.

Upvotes: 1

epascarello
epascarello

Reputation: 207501

When JavaScript gets to it, it is too late. Plus JavaScript can not do it.

Upvotes: 2

Related Questions