user965748
user965748

Reputation: 2387

Links that don't pass referrer

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.

Upvotes: 2

Views: 1015

Answers (5)

user965748
user965748

Reputation: 2387

It seems the easiest is the iframe dirty way.

Upvotes: 0

jeremy
jeremy

Reputation: 4314

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

Upvotes: 0

Christian
Christian

Reputation: 19740

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

Upvotes: 0

powtac
powtac

Reputation: 41050

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

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

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114377

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.

Upvotes: 1

Related Questions