问题原文
原帖链接 · Drkawashima · CC BY-SA 4.0
We've had a policy to always set rel="noopener" for all external links.
However is that necessary if the external link is to a site in our own control?
Let's say we own both coffee.example.com and milk.example.com - should we add those attributes when linking from one site to the other?
To me it feels unnecessary.
However, a colleague disagrees and says it's always a good idea to include at least rel="noopener" when linking to ANY other site, no matter what.
EDIT: I also notice that Lighthouse will complain about external links without rel="noopener". So the question is if it's just considered best practice to add that attribute for all external links even if you control the site being linked to.
已采纳解答
原帖链接 · Maximillian Laumeister · CC BY-SA 4.0
Is it necessary? No. Is it best practice to do it anyway? Yes.
Here are a few reasons:
Ownership and management of external sites can change, leaving them in less trusted hands. You would need to remember to go back and change all your links.
The hosting setup of external sites (even subdomains) can be heterogeneous, meaning that a compromise in the server software of one domain could more easily compromise the experience of visitors to the other domain.
By always using noopener, you don't need to keep a list of "trusted" and "untrusted" domains, then audit your links to make sure the links to untrusted domains have the noopener attribute. If your policy is to add noopener to all external links, it's easy to tell at a glance if a particular link is noncompliant with your policy.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
