user597720
user597720

Reputation:

Why is the value of "base rel=" ignored?

I want to add 'noreferrer' to all the links on my static html page, without having to worry about forgetting to add it to some new link in the future. I tried using base rel="noreferrer" as occasionally suggested but it doesn't seem to work. With this simple page:

<html>
  <head>
    <base rel="noreferrer">
  </head>
  <body>
    <a href="linktest.html">no rel</a>
    <br />
    <a rel="noreferrer" href="linktest.html">rel</a>
  </body>
</html>

and using Chromium 73 on Debian 9 (stable), when I click on the first link the access log shows a referrer:

10.0.0.1 - - [02/May/2019:11:32:02 -0700] "GET /linktest.html HTTP/1.1" 304 330 "https://www.example.com/linktest.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" 

but not when I click the second link, that had rel="noreferrer" explicitly specified:

10.0.0.1 - - [02/May/2019:11:32:06 -0700] "GET /linktest.html HTTP/1.1" 304 330 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36" 

I also tried adding target="_blank" to the base tag but it didn't change the referrer behavior, just forced the links to open in a new tab by default (which I don't want).

Should this work? If so, why doesn't this work?

Is there a way (preferably without using javascript) to force all links from a page to suppress the referrer, that will work at least with my browser and preferably with most modern browsers?

Upvotes: 1

Views: 218

Answers (1)

cygri
cygri

Reputation: 9482

I believe you are looking for:

<meta name="referrer" content="no-referrer">

That’s according to MDN, but I haven’t been able to verify that it works.

The base element does not have a rel attribute according to the specs.

Upvotes: 1

Related Questions