Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review the way makeOutboundLink() handles rel noopener noreferrer #724

Open
afercia opened this issue Sep 5, 2018 · 2 comments
Open

Review the way makeOutboundLink() handles rel noopener noreferrer #724

afercia opened this issue Sep 5, 2018 · 2 comments

Comments

@afercia
Copy link
Contributor

afercia commented Sep 5, 2018

makeOutboundLink() is a component to render links that use target="_blank" which does a few things:

  • renders the attribute target: "_blank" 馃帀
  • adds a visually hidden text (Opens in a new browser tab) for accessibility
  • renders by default an attribute rel="noopener noreferrer" for security reasons (exploitation of the window.opener API)

Although the rel="noopener noreferrer" can be omitted passing a prop rel={ null } or changed passing a different value, we should consider to review the way makeOutboundLink() works.

As @jono-alderson pointed out, rel="noopener noreferrer" nukes tracking links, as some tracking services rely on JavaScript in addition to the Referer: HTTP header. See also Yoast/wordpress-seo#10791

  • noreferrer: Prevents the browser, when navigating to another page, to send this page address, or any other value, as referrer via the Referer: HTTP header
  • noopener: ensures window.opener is null (more details

Most of the links handled by makeOutboundLink() point to yoast.com. In these cases, rel="noopener noreferrer" should be omitted, being aware that yoast.com should always be secure and trusted. For other external, non-trusted, links, rel="noopener noreferrer" should still be used.

Worth considering to automate this behavior or, at least, reverse the default behavior of makeOutboundLink().

@afercia afercia changed the title Review how makeOutboundLink() handles rel noopener noreferrer Review the way makeOutboundLink() handles rel noopener noreferrer Sep 5, 2018
@afercia
Copy link
Contributor Author

afercia commented Sep 10, 2018

Note: worth noting Gutenberg adds rel="noopener noreferrer" by default to all the links with a target="_blank" attribute, to match what TinyMCE does by default.

@IreneStr IreneStr added backlog and removed next labels Sep 14, 2018
@afercia
Copy link
Contributor Author

afercia commented Sep 28, 2018

It was decided the new pattern to use is:

  • use noopener for all the non-yoast.com external links
  • omit it for the yoast.com links (including shortened links)

makeOutboundLink should be updated accordingly to make its usage easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants