HTML Link Attributes: target, download and rel
Choose how a destination opens
The default target is usually the current browsing context (_self), unless a base target changes it. _blank requests a new browsing context, often a tab. Respect user preferences; tell users if a link is designed to open elsewhere.
<a href="https://example.org/guide" target="_blank" rel="noopener">External guide (opens in new tab)</a>The browser may open a new tab or window. The URL is illustrative.
Suggest a download
The download attribute requests saving the resource and can suggest a filename. It works for same-origin URLs and data or blob URLs; cross-origin resources depend on server behavior and browser policy. A filename is a suggestion, not a guarantee.
<a href="data:text/plain,Workshop%20notes" download="notes.txt">Download notes (text file)</a>If permitted by the browser or editor sandbox, the link downloads a small text file.
Describe link relationships and privacy
rel takes space-separated relationship tokens. noopener prevents the destination from receiving an opener reference; modern browsers generally apply this automatically to _blank unless explicitly overridden. noreferrer additionally suppresses referrer information. Use the latter when that privacy behavior is desired, not merely to open a tab.
<a href="https://example.org/" target="_blank" rel="noopener noreferrer">External resource (opens in new tab)</a>Both tokens are present; the destination should not receive opener access or referrer information.
Practice and next steps
Create a link to an external resource that warns about a new tab, then explain when you would omit target and when noreferrer is appropriate.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Link Attributes: target, download and rel — Knowledge Check
Check the core concepts from this lesson.
What does target="_blank" request?
Which token additionally suppresses referrer information?
What does download="notes.txt" do?
What is the purpose of rel="noopener" on an external new-context link?
Why should a link opening a new tab give users a clear indication when relevant?