The referrerpolicy attribute indicates which referrer information to send when fetching resources or navigating using an SVG <a> element's link. You can use this attribute with the following SVG elements:
- a
Example
<svg viewBox="0 0 150 20" xmlns="http://www.w3.org/2000/svg">
<a href="https://example.com" referrerpolicy="origin">
<text x="5" y="15">Website</text>
</a>
</svg>
Example
Usage notes
<table class="properties"> <tbody> <tr> <th scope="row">Value</th> <td> <code>no-referrer</code> | <code>no-referrer-when-downgrade</code> | <code>origin</code> | <code>origin-when-cross-origin</code> | <code>same-origin</code> | <code>strict-origin</code> | <code>strict-origin-when-cross-origin</code> | <code>unsafe-url</code> </td> </tr> <tr> <th scope="row">Default value</th> <td><code>strict-origin-when-cross-origin</code></td> </tr> <tr> <th scope="row">Animatable</th> <td>No</td> </tr> </tbody> </table>
no-referrer- : The Referer header will not be sent.
no-referrer-when-downgrade- : Sends the full URL (origin, path, and query string) when the protocol security level is the same or better (HTTP→HTTP, HTTP→HTTPS, HTTPS→HTTPS), but sends no header to a less secure destination (HTTPS→HTTP).
origin- : The Referer header will only send the origin of the URL. For example, a document at
https://example.com/page.htmlwill sendhttps://example.com/as the referrer.
- : The Referer header will only send the origin of the URL. For example, a document at
origin-when-cross-origin- : Sends the full URL when performing a Same-origin_policy request, but only sends the origin for cross-origin requests, and sends no header to a less secure destination (HTTPS→HTTP).
same-origin- : Only sends the full URL to a Same-origin_policy request, but sends no header for cross-origin requests.
strict-origin- : Sends only the origin when the protocol security level stays the same, but sends no header to a less secure destination.
strict-origin-when-cross-origin- : Default value. Sends the full URL when performing a Same-origin_policy request, but only sends the origin for cross-origin requests, and sends no Referer header to a less secure destination.
unsafe-url- : Sends the full URL when performing any task regardless of security.
[!WARNING] This policy will potentially leak private information when navigating from HTTPS to HTTP.
- : Sends the full URL when performing any task regardless of security.
Specifications
Browser compatibility
See also
- href
- Referrer-Policy header
- SVGAElement.referrerPolicy
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
