# 移除外部链接引荐引的选项

**URL:** <https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437>\
**Category:** Feature\
**Created:** [2022年五月18日 19:58 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437 "2022-05-18T19:58:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nordize](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nordize](https://meta.discourse.org/u/nordize)\
**Post date:** [2022年五月18日 19:58 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437/1 "2022-05-18T19:58:16Z")

</div>

我们许多人使用 Discourse 进行私人/敏感通信，并且已经付出了巨大的努力和关注来保护隐私，以尽量减少信息从论坛泄露（例如，从电子邮件中删除文本、原始 URL 等）。

我们能否在设置中添加一个选项，将指向论坛基础 URL 之外的链接添加 `rel=noreferrer`？

我实际上会默认启用它，或者有一个全局的私有/公共开关，可以启用/禁用 Discourse 的所有隐私选项。这可以作为设置向导的一部分。

所有浏览器都支持它（如果你忽略僵尸的话）：[rel="noreferrer" - HTML | MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/noreferrer)

编辑：对于感兴趣的人来说，在此期间，您可以使用自定义主题组件，该组件将 `<meta name="referrer" content="same-origin">` 添加到 HTML 的 `<head>` 中。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2022年五月18日 20:02 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437/2 "2022-05-18T20:02:40Z")

</div>

添加一个站点设置，将 `Referrer-Policy` 标头从默认的 `strict-origin-when-cross-origin` 更改为其他有效值，会更容易。

---

<div class="post-metadata">

**Author:** ![nordize](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nordize](https://meta.discourse.org/u/nordize)\
**Post date:** [2022年五月18日 20:04 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437/3 "2022-05-18T20:04:02Z")

</div>

我认为这在浏览器中已被弃用，或者并非所有浏览器将来都会支持它（`rel=noreferrer` HTML 标签也是如此）。我最近对此进行了研究，并回想起最安全、最兼容的跨浏览器选项是 `rel=noreferrer`，但如果我记错了，我很乐意被纠正。

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2022年五月18日 20:07 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437/4 "2022-05-18T20:07:16Z")

</div>

> [@nordize](#):
>
> 我认为这在浏览器中已被弃用，

这是不正确的。Discourse 支持的所有浏览器都支持该标头。

> **[Referrer-Policy header - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy)**
>
> The HTTP Referrer-Policy response header controls how much referrer information (sent with the Referer header) should be included with requests.
> Aside from the HTTP header, you can set this policy in HTML.

> **[Referrer Policy | Can I use... Support tables for HTML5, CSS3, etc](https://caniuse.com/referrer-policy)**
>
> "Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.

---

<div class="post-metadata">

**Author:** ![nordize](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nordize](https://meta.discourse.org/u/nordize)\
**Post date:** [2022年五月18日 20:18 UTC](https://meta.discourse.org/t/option-to-remove-the-referrer-for-external-links/227437/5 "2022-05-18T20:18:07Z")

</div>

嗯，这确实看起来很安全……我不记得在哪里读到的了，就信以为真了。我已经在使用一个自定义组件来添加 `<meta name="referrer" content="same-origin">`，但对未来感到担忧。不过，Discourse 的选项会更好。
