HTML Security Flashcards

1
Q

Anchor Tag

How do you secure a link that leads to an external resource?

A

It is recommended to set attributes that prohibit the opened link from accessing the page from which it was opened.

Adding the “rel” attribute with the “noopener”, “noreferrer”, and “nofollow” values when opening the link in a new tab will block the external resource from accessing the “window.opener” object of the original page and prevent it from passing HTTP headers to it.

This will work for same-origin or cross-origin links.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly