Search code examples
javascripthyperlinktargetreferrerspoofing

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.


Solution

  • It seems the easiest is the iframe dirty way.