Referrer-Policy

Referrer-Policy is an HTTP response header that controls how much of the page URL the browser sends to other pages in the Referer header. The default is strict-origin-when-cross-origin.

HTTP header

Also called referrerpolicy

Updated

On this page

How it works

When a page loads an image, a script, or a frame, or a visitor follows a link, the browser can send the page URL in the Referer header. Referrer-Policy sets how much of that URL goes out: the full URL, only the origin, or nothing. The full URL means the origin, path, and query string.

You can set the policy for the whole page with the header or with <meta name="referrer">. You can set it for one element with the referrerpolicy attribute on <iframe>, <a>, <img>, <script>, and <link>. On an iframe, the referrerpolicy attribute sets the policy for the request that loads the frame.

Values

ValueWhat the browser sends
no-referrerNothing.
no-referrer-when-downgradeThe full URL, but nothing from HTTPS to HTTP.
originOnly the origin.
origin-when-cross-originThe full URL to the same origin. Only the origin to other origins and from HTTPS to HTTP.
same-originThe full URL to the same origin. Nothing to other origins.
strict-originOnly the origin, and nothing from HTTPS to HTTP.
strict-origin-when-cross-origin (default)The full URL to the same origin. Only the origin to other origins. Nothing from HTTPS to HTTP.
unsafe-urlThe full URL to all pages, also from HTTPS to HTTP. This can leak private data in the URL.

The browser also uses the default when the value is not valid.

Example

HTML
<iframe
  src="https://partner.example/widget"
  referrerpolicy="no-referrer"
></iframe>

The browser sends no Referer header when it loads this frame, so the partner does not see your page URL.

How to set it

Send the header to set one policy for the whole page. Use the referrerpolicy attribute to change it for one element.

Referrer-Policy: strict-origin-when-cross-origin

The header can list fallback values, for example no-referrer, strict-origin-when-cross-origin. The browser uses the last value it knows. The attribute takes only one value.

Learn more

Sources

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.