By default a link opens in the same tab. The target attribute changes that.
| Value | Where the link opens |
|---|---|
_self | The same tab (default) |
_blank | A new tab or window |
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Open the example in a new tab</a>
Always add rel with _blank
rel describes the relationship between your page and the link. For target="_blank" add rel="noopener noreferrer". It stops the new page from being able to control your page and keeps your address from being passed on. Modern browsers already protect against the first problem, but adding it is still good practice and harmless.
Other useful rel values
| Value | Use |
|---|---|
nofollow | Tell search engines you do not endorse the link |
sponsored | The link is paid or an advertisement |
ugc | The link was added by users, for example in comments |
When to open a new tab
New tabs can be annoying. Visitors can open one themselves when they want it. A new tab is reasonable when leaving the page would lose something, such as a half-filled form. If you open new tabs, say so in the link text, for example “(opens in a new tab)”.