href中的mailto:我应该添加rel noopener,noreferrer吗? [英] mailto in href: should I add rel noopener,noreferrer?

查看:113
本文介绍了href中的mailto:我应该添加rel noopener,noreferrer吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有以下HTML代码:

Assuming I have this HTML code:

<a href="mailto:me@example.org" target="_blank"></a>

据我所知,出于安全和隐私的原因,最佳实践告诉我必须在每个外部链接上添加rel="noopener noreferrer".我是否必须将mailto链接视为外部链接?

As far as I know, for security and privacy reason, best practices tells I have to add rel="noopener noreferrer" on every link that goes outside. Do I have to consider a mailto link as an external link?

推荐答案

在邮件中,我认为这没有任何区别.引荐来源标头包含源链接位置的URL-但是电子邮件没有 URL,因此在这种情况下,我希望引荐来源标头为空或不存在.

Within a mail message, I think it won't make any difference. Referrer headers include the URL of the location of the source link - but an email message does not have a URL, so I'd expect the referrer header to be empty or absent in that case.

不可能在电子邮件客户端中使用navigator.registerProtocolHandler之类的东西,因为它们通常不支持任何类型的脚本.当您使用网络邮件客户端时,这可能会有所不同,但我尚未对此进行测试.

It's not possible to use things like navigator.registerProtocolHandler in an email client because they typically don't support any kind of scripting. When you're using a webmail client this might behave differently, but I've not tested that.

反之,如果您有一个网页,其中包含已发送到邮件客户端的mailto链接,那么我再也没有见过使用引荐来源网址做任何事情的邮件客户端,因为它不是HTTP客户端并且不处理HTTP请求,而是处理协议切换.

Going the other direction, if you have a web page containing the mailto link that gets sent to a mail client, I've never seen a mail client that does anything with a referrer URL, again, because it's not an HTTP client and is not handling an HTTP request, but a protocol hand-off.

总体设置rel="noopener noreferrer"不会损害您的链接,但是从功能或安全的角度来看,我怀疑它也不会做任何有用或有趣的事情.

Overall setting rel="noopener noreferrer" will not harm your links, but I suspect it won't do anything useful or interesting from a functionality or security point of view either.

这篇关于href中的mailto:我应该添加rel noopener,noreferrer吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆