大网数据广告活动
Web 标准与前端开发

referrerpolicy

· 52CE 我爱测

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:

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.html will send https://example.com/ as the referrer.
  • 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.

Specifications

Browser compatibility

See also

  • href
  • Referrer-Policy header
  • SVGAElement.referrerPolicy

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。