HTML <a> referrerpolicy attribute
Definition and usage
referrerpolicy
The attribute specifies the referrer information (referrer information) to be sent when the user clicks on a hyperlink.
Example
Set referrerpolicy for links:
<a href="https://www.codew3c.com" referrerpolicy="origin">
Syntax
<a referrerpolicy="no-referrer|no-referrer-when-downgrade|origin|origin-when-cross-origin|same-origin|strict-origin-when-cross-origin|unsafe-url">
Attribute value
Value | Description |
---|---|
no-referrer | Do not send referrer information. |
no-referrer-when-downgrade | Default. If the protocol security level remains unchanged or higher (HTTP to HTTP, HTTPS to HTTPS, HTTP to HTTPS are all possible), then send the origin, path, and query string. Do not send any content to a lower security level (HTTPS to HTTP is not allowed). |
origin | Send the origin of the document (protocol, host, and port). |
origin-when-cross-origin | Send the document's origin for cross-origin requests. Send the origin, path, and query string for same-origin requests. |
same-origin | Send the reference page information for same-origin requests. Do not send reference page information for cross-origin requests. |
strict-origin-when-cross-origin | Send the source if the protocol security level remains the same or higher (HTTP to HTTP, HTTPS to HTTPS, and HTTP to HTTPS are all possible). For less secure levels (from HTTPS to HTTP), do not send any content. |
unsafe-url | Send the source, path, and query string (not considering security). Use this value with caution! |
Browser Support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
51.0 | 79.0 | 50.0 | 11.1 | 38.0 |