2

I want to create a list of links opening the targets in new tabs from my private page and I don't want the referring URL to be passed on. I tried the following method, but it didn't solve the problem:

<script>
function op(url){
  window.open(url.replace(/<(?:.|\n)*?>/gm,''),'_newtab');
}
</script>    
<span onclick="javascript:op(this.innerHTML);">http://www.google.com<span>

Is there any way how to spoof or blank the referrer? In the worst case I might create an iframe and put the page with links on some free hosting, but I'd prefer some more elegant solution. The only requirements are tha t it should work in Chrome, Opera, IE and FF (2011+ versions), accessibility is not an issue, since it'll be used by very few users I know.

user965748
  • 2,227
  • 4
  • 22
  • 30
  • 1
    As long as you are not being a _naughty_ web developer, you shouldn't need to turn it off... – Alex Wayne Nov 21 '12 at 18:27
  • 2
    @AlexWayne not true. Protecting user's privacy (aka, hiding where they are referred from) isn't naughty at all. For example, a google doc accesses by private URL shouldn't pass the private URL to any page linked to within that doc. – scosman Mar 10 '15 at 15:56

5 Answers5

1

The referring URL is part of the HTTP protocol, not the mark-up. You can't change this.

Also, you never need to specify javascript: in an event handler. It's always is and can only be javascript.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
0

There is a rel="noreferrer" which is not yet suported by Firefox...

See also https://stackoverflow.com/a/8957778/22470

Community
  • 1
  • 1
powtac
  • 40,542
  • 28
  • 115
  • 170
0

Create a tiny app on Heroku that receives a URL then forwards the user.

Christian
  • 19,605
  • 3
  • 54
  • 70
0

You could redirect to an intermediate page that redirects to the final website, this would hide the true referer.

jeremy
  • 4,294
  • 3
  • 22
  • 36
0

It seems the easiest is the iframe dirty way.

user965748
  • 2,227
  • 4
  • 22
  • 30