0Pricing
HTML Academy · Lesson

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

  1. The anchor Element and href Attribute
  2. Absolute vs Relative URLs
  3. Opening Links in New Tabs and Download Attribute
  4. Linking to Sections Fragment Identifiers
← Back to HTML Academy