OnlineCBT Logo OnlineCBT
HTML Tutorial
HTML · LESSON 16

Opening Links and Download Files

By Ratan Updated: 16 Oct 2026

Configure link targets (target='_blank'), email links (mailto:), phone links, and file downloads.

Level: Beginner to Advanced
Duration: ~60 Mins Deep-Dive

1. Controlling Where Links Open: The target Attribute

By default, clicking an anchor tag opens the destination URL in the current browser tab. You can customize this behavior using the target attribute:

Value Behavior
_self Default. Opens the link in the same window/tab.
_blank Opens the link in a brand new browser tab or window.
_parent Opens the link in the parent frame.
_top Opens the link in the full body of the current window, escaping iframes.

2. Security Best Practice: rel="noopener noreferrer"

Whenever opening links in a new tab with target="_blank", always add rel="noopener noreferrer". Without this, the newly opened window gets access to the originating window's window.opener JavaScript object, which malicious third-party websites can exploit for phishing attacks (reverse tabnabbing).



    Visit Official NTA Portal

3. Downloadable Files with the download Attribute

To prompt the browser to download a file (such as a syllabus PDF or question paper) rather than navigating to it, add the download attribute:



    Download Syllabus (PDF)

4. Email and Telephone Links


Email Support


Call Helpline (+91 8118802068)

📝 Live Lesson Practice

HTML/CSS JavaScript Python C++ C PHP
⌨️ Practice Inputs (लाइव इनपुट भरें) (खाली होने पर RED, भरने पर GREEN underline)
💻 Code Editor (Monaco VS Code Engine)
👀 Live Preview
Address Contact

+91 7877547686

E-mail

onlinecbtportal@gmail.com

Helpline Number

+91 7877547686


Click To Download
Get it on Google Play

ऐप डाउनलोड करने
के लिए Google Play पर
उपलब्ध है

WhatsApp Chat