Opening Links in New Tabs and Download Attribute
Use target and download attributes for link behavior.
Opening in a New Tab
The target attribute controls where the linked document opens:
<a href="https://example.com" target="_blank">Open in new tab</a>
<!-- target values:
_blank → new tab (or window)
_self → same tab (default)
_parent → parent frame
_top → full window (exits frames)
-->The Security Risk of _blank
target="_blank" without precautions creates a security vulnerability:
- The new page can access the opener via
window.opener - A malicious page could redirect the original tab
- This attack is called reverse tabnapping
All lessons in this course
- The anchor Element and href Attribute
- Absolute vs Relative URLs
- Opening Links in New Tabs and Download Attribute
- Linking to Sections Fragment Identifiers