Mister Someone
Mister Someone

Reputation: 101

Do I need to put rel="noopener" to each target="blank" even if the pointed website is from my own site?

When using a link with target="__blank", it's recommended to add rel="noopener" too for security reasons. But do I need it to add this even for the links pointing my own website?

<a href="internal/link/in/my/website" target="__blank>ClickMe</a>
<!--Do I need to add rel="noopener"?-->

Upvotes: 1

Views: 790

Answers (1)

snack_overflow
snack_overflow

Reputation: 546

If you're pointing to your own site then no, if you're pointing to a third-party then it is recommended.

The reason being that rel="noopener" prevents the new page from being able to access the window.opener property and ensures it runs in a separate process.

You can read some more about window.opener here: When to use window.opener / window.parent / window.top

Upvotes: 1

Related Questions