Link Targets and rel Attributes
Two attributes shape how a link behaves and what it tells other systems: target decides where the linked document opens, and rel describes the relationship between the current page and the link's destination — information search engines and browsers both read.
target Attribute Values
Value | Behavior |
|---|---|
| Default — opens in the same browsing context (same tab) |
| Opens in a new tab or window |
| Opens in the parent frame, if the page is inside an |
| Opens in the full body of the window, breaking out of any frames/iframes |
target-values.html
<a href="/about" target="_self">About (same tab, default)</a> <a href="https://example.com" target="_blank" rel="noopener noreferrer">Docs (new tab)</a> <!-- Inside an iframe --> <a href="/dashboard" target="_parent">Escape one level of frame</a> <a href="/dashboard" target="_top">Escape all frames</a>
rel Attribute Values
rel documents the relationship between the current document and the linked one. Some values matter for security, others for search engines.
Value | Meaning |
|---|---|
| Tells search engines not to pass ranking credit through this link |
| Prevents the new page from accessing |
| Also strips the |
| Marks a link as paid/sponsored (ads, affiliate links) for search engines |
| Marks a link as user-generated content (comments, forum posts) |
rel-values.html
<!-- An affiliate link --> <a href="https://shop.example.com/item" rel="sponsored nofollow">Buy this product</a> <!-- A link posted by a forum user --> <a href="https://randomsite.example" rel="ugc nofollow">check this out</a> <!-- A trusted external resource, opened safely in a new tab --> <a href="https://developer.mozilla.org" target="_blank" rel="noopener noreferrer">MDN</a>
Why rel Matters for SEO
Search engines use
nofollow/sponsored/ugcto decide whether a link should influence the destination site's ranking — important for compliance with ad and affiliate disclosure guidelines.Sites that sell links or run heavy affiliate programs are expected to mark them
sponsored, or risk penalties for manipulating search rankings.Comment sections and forums should mark outbound user links
ugc(ornofollow) so spammy links don't pass ranking value to their targets.
Why rel Matters for Security
noopener and noreferrer protect against tabnabbing — where a page opened via target="_blank" uses window.opener to silently redirect the original tab to a phishing page while the user is focused on the new one.
Quick Reference
Attribute | Typical use |
|---|---|
| Open link in a new tab |
| Always pair with |
| Untrusted or paid link, don't pass SEO credit |
| Advertisement or affiliate link |
| User-submitted content link |