Beyond the “Href”
The World Wide Web, in its most elemental form, is a vast, interconnected tapestry of documents. The defining feature that transforms this collection of isolated files into a “web” is the hyperlink. For the vast majority of internet users, and indeed for many who casually build upon it, the hyperlink is a simple, binary mechanism: you click, and you arrive. In the early education of web literacy, the focus is almost exclusively placed on the href attribute—the Hypertext Reference. The href is the destination. It is the address on the envelope, the coordinate on the map, the “where” of the digital journey.1
However, to view a link solely as a destination is to overlook the complex logistical operation that occurs every time a user interacts with an anchor tag. If the href is the destination, the accompanying attributes—specifically target, rel, and download—are the detailed instructions on how to travel there. They determine the vehicle, the route, the security protocols, and the handling of the cargo upon arrival.
Consider a physical analogy: If you were to send a package to a friend (the destination/href), simply knowing the address is insufficient for the logistics company. You must specify instructions: “Do not bend,” “Signature required,” “Leave at front door,” or “Deliver via express air.” In the browser environment, a standard link without attributes is akin to a standard ground delivery—it gets there eventually, replacing the current contents of the user’s view with the new package. But modern web development requires more nuance. Sometimes the instruction is “Open this in a completely new vehicle while keeping the current one running” (target=”_blank”). Other times it is “Download this package immediately, do not open it” (download). Or, crucially for security, “Deliver this, but do not tell the recipient where I live” (rel=”noreferrer”).
This report serves as a comprehensive manual for controlling the “click.” It is written for the thoughtful architect of digital experiences who seeks to master the subtle mechanics of browser behavior. We will move beyond the surface level of navigation to explore the deep infrastructure of browser contexts, the hidden security risks of tab management, and the critical performance implications of how links connect—or isolate—web pages. By mastering these attributes, we transition from merely linking pages to engineering secure, performant, and intuitive user journeys.
The Anatomy of an Instruction
At a technical level, the HTML anchor tag (<a>) is a command sent to the browser’s navigation engine. When a user clicks, the browser parses the tag’s attributes to build a navigation request.
- The Destination (href): “Go to https://wikipedia.org.”
- The Context (target): “Open this in a new tab.”
- The Relationship (rel): “Disconnect the new tab from this one so it cannot speak to us.”
When these instructions are missing, the browser falls back to defaults that were established in the early 1990s. While these defaults ensure the web remains functional, they often prioritize legacy compatibility over modern security and user experience standards. The “default click” (opening in the same tab, passing referrer data, sharing the processing thread) is rarely the optimal interaction for every link on a modern, complex web application.
Opening in a New Tab (target=”_blank”)
Among all the modifications one can make to a link, none is as ubiquitous—or as controversial—as the instruction to open a new tab. In HTML, this is achieved using the target attribute with the value _blank.
The Behavior: Context Switching
To understand target=”_blank”, one must first understand the concept of a “Browsing Context.” A browsing context is the environment in which a browser displays a Document. In a modern graphical browser, a “tab” is the visual representation of a browsing context.
By default, when a user clicks a link, the browser operates with a target=”_self” behavior. This means the browser takes the new URL, fetches the content, and “unloads” the current document from the active browsing context, replacing it with the new document. This is the foundational interaction of the web; it builds a linear history chain (Page A -> Page B -> Page C), allowing the “Back” button to traverse the stack in reverse.
When a developer adds target=”_blank” to the link, they are issuing a command to the browser to fork the browsing session.
- The Command: <a href=”…” target=”_blank”>
- The Action: The browser pauses. Instead of unloading the current document, it allocates system memory for a new top-level browsing context.
- The Result: The user now has two active interfaces. The original page remains alive, maintaining its scroll position and form data, while the new page loads in a parallel stream.
This behavior, while seemingly simple, fundamentally alters the user’s relationship with the application. The linear history is broken. The “Back” button in the new tab is greyed out because there is no history in this fresh context. The user cannot “go back”; they must “close” and “return”.
The Strategic Utility: When to Force the Fork
Given the disruption to the “Back” button, usability experts have historically advised against opening new tabs. However, there are specific scenarios where replacing the current page is objectively detrimental to the user experience. The decision to use target=”_blank” should never be arbitrary; it should be a calculated decision to preserve the user’s “state.”
External Links and “Site Stickiness”
The most common use case is linking to external domains. The logic, often driven by marketing teams, is that if a user clicks a link to Wikipedia or a partner site, the site owner does not want the user to “leave” their property entirely. By opening the external site in a new tab, the original site remains open in the background. When the user finishes reading the external content and closes the tab, they are immediately returned to the original site. This technique is used to improve “Time on Site” metrics and reduce “Bounce Rates”.
The “Workflow Protection” Imperative
A more user-centric justification for target=”_blank” is the protection of ongoing work. Consider a user filling out a complex, multi-page application for a bank loan or a government visa.
- The Scenario: The user is on page 4 of the form. They encounter a question asking if they comply with “Regulation 12-B.” They do not know what this is.
- The Link: There is a link labeled “Read Regulation 12-B.”
- The _self Disaster: If this link opens in the same tab, the form is unloaded. Unless the site has sophisticated auto-saving, the user’s data on page 4 is lost. Upon pressing “Back,” they may find an empty form.
- The _blank Solution: By opening the regulation text in a new tab, the form remains open and untouched. The user reads the regulation, closes the tab, and resumes typing exactly where they left off.
Media and Persistent Connections
In the era of single-page applications (SPAs) and rich media, keeping a page “alive” is often functional, not just navigational. If a user is listening to a web-based music player or participating in a live chat support session, navigating away effectively “kills” the audio stream or disconnects the chat. In these instances, any link that leads to static content (like a user profile or a transcript) must open in a new tab to prevent severing the active media session.
The Non-HTML Document
Users have different mental models for “pages” versus “files.” When a user clicks a link to a webpage, they expect navigation. When they click a link to a PDF, a Word document, or a high-resolution image map, they often expect a reference document. Opening a heavy PDF in the same tab can be jarring, especially if the browser’s PDF viewer lacks clear navigation controls to return to the site. Segregating these static assets into separate tabs allows the user to reference the document side-by-side with the web application.
The Analogy of Travel: Why “Target” Matters
To better visualize this for a non-technical stakeholder, consider the analogy of a train journey.
- Default Link (_self): You are on a train (your browser tab). You see a sign for a new destination. You get off the train at the next station and transfer to a new train to go there. You are no longer on the first train. To go back, you must catch a train in the opposite direction.
- New Tab Link (_blank): You see the sign for the new destination. Instead of getting off, you spawn a clone of yourself. The clone gets on the new train to the new destination. The original you stays comfortably in your seat on the first train, perhaps holding your place in a book (your form data). When the clone is done, they vanish, and you remain exactly where you were.
However, as we will explore in the next section, this “cloning” process comes with a hidden danger: historically, the clone and the original traveler remained telepathically linked, allowing the clone to manipulate the original traveler’s environment.
The Security & Performance Risk: The “Tabnabbing” Vulnerability
For many years, web developers added target=”_blank” to links without a second thought, unaware that they were introducing a significant security flaw into their applications. This vulnerability is known as Reverse Tabnabbing.
3.1 The Mechanism: The window.opener Connection
When a browser opens a new tab via target=”_blank”, it creates a parent-child relationship between the two tabs. To facilitate potential communication (a feature intended for legitimate uses like popup login windows), the browser gives the new page a reference to the original page.
In JavaScript—the programming language that powers web interactivity—this reference is contained in an object called window.opener.
- The “Window”: This represents the browser tab.
- The “Opener”: This is the tab that opened the current tab.
So, if you click a link on YourSite.com that opens ExternalSite.com in a new tab, ExternalSite.com has access to window.opener, which effectively points back to YourSite.com.
The Heist: How the Attack Works
Imagine you are the administrator of a community forum or a social media platform where users can post links.
- The Bait: A malicious user posts a link to a blog post: “Check out this funny cat picture!” The link is coded to open in a new tab.
- The Click: A victim, logged into your secure forum, clicks the link. A new tab opens, loading the “funny cat picture” site.
- The Switch: The victim is distracted, laughing at the cat picture in the new tab. The malicious site, in the background, runs a tiny piece of JavaScript code:
JavaScript
window.opener.location = “https://fake-login-page.com”; - The Trap: This code reaches back to the original tab (your forum) and commands it to navigate to a new URL. The victim doesn’t see this happen because they are looking at the cat picture.
- The Capture: The victim closes the cat picture tab and returns to the forum tab. However, the forum tab has been replaced by a phishing site that looks exactly like the forum’s login page, perhaps displaying a message like “Session Expired. Please log in again.”
- The Theft: Believing the site is legitimate (since they never actively navigated away from it), the victim enters their username and password. The attacker now captures these credentials.
This attack is effective because it exploits the user’s trust in the permanence of the original tab. We are trained to check the URL bar when we click a link, but we rarely re-check the URL bar of a tab we opened ten minutes ago.
The Performance Toll: The Main Thread Block
The window.opener connection is not just a security risk; it is a performance bottleneck. Because the browser assumes the two tabs might need to communicate, it often places them on the same processing thread.
Think of the “Main Thread” as a single-lane highway that the browser uses to process tasks: drawing images, calculating layouts, and running scripts.
- Scenario: The user opens a new tab to a heavy, poorly optimized website full of ads and tracking scripts.
- The Problem: Because the new tab shares the “highway” (thread) with the original tab, the traffic jam caused by the new site backs up the original site.
- The Symptom: The user tries to scroll or click a button on the original tab, but it feels frozen or “janky.” The original page is waiting for the new page to finish its calculations.
This violates the principle of Process Isolation. In an ideal browser architecture, if one tab crashes or slows down, it should have zero effect on other open tabs. The default target=”_blank” behavior breaks this isolation.
The Solution: rel=”noopener noreferrer”
To close this security hole and sever the performance-draining link between tabs, we use the rel (relationship) attribute. The rel attribute allows us to specify the relationship between the current document and the linked document.
The Shield: noopener
The noopener keyword is the specific antidote to the window.opener vulnerability. When you add rel=”noopener” to a link:
- The browser opens the new tab as requested.
- Crucially, it sets the window.opener property of the new tab to null (nothing).
- The new tab has no reference to the old tab. It cannot control it, redirect it, or access its data.
- Bonus: Because there is no communication channel, the browser is free to run the new tab in a completely separate process (a different “highway”), ensuring that if the new site is slow, the old site remains fast.
The Cloak: noreferrer
The noreferrer keyword takes privacy a step further. In addition to severing the window.opener connection (just like noopener), it instructs the browser not to send the HTTP Referrer Header.
Normally, when you arrive at a website, your browser hands the site a digital “calling card” saying, “I came here from google.com” or “I came here from facebook.com.” This is how analytics tools track traffic sources.
Using rel=”noreferrer” tells the browser: “Do not show them the calling card.” The destination site will see the visitor as “Direct Traffic,” as if they had typed the URL manually. They will have no idea where the user came from.
The Combined Best Practice
For maximum compatibility and security, the gold standard for many years has been to use both. While modern browsers have evolved (discussed below), pairing them ensures coverage for older legacy browsers that might support one but not the other.
Visualizing the Code Structure (The “Secure New Tab Link”)
For the learner without a programming background, consider the HTML link as a sentence with specific grammar.
The “Vulnerable” Sentence:
“Take the user to Example.com (href) and open it in a New Tab (target).”
The Code:
HTML
<a href=”https://example.com” target=”_blank”>
Click Here (Unsafe)
</a>
The “Secure” Sentence:
“Take the user to Example.com (href), open it in a New Tab (target), but do not let the new tab see us (noopener) and do not tell them where we came from (noreferrer).”
The Code:
HTML
<a href=”https://danimai.org” target=”_blank” rel=”noopener noreferrer”>
Click Here (Secure)
</a>
The Evolution of Defaults (2021 Update)
It is important to acknowledge a major shift in the web ecosystem. Recognizing that target=”_blank” was a massive security liability that millions of developers were failing to patch, browser vendors (Google Chrome, Safari, Firefox, Edge) changed the default behavior.
Starting around 2021 (Chrome v88, Safari v12.1), browsers began to implicitly treat target=”_blank” as if it had rel=”noopener” applied. This means that on a modern, up-to-date browser, a simple target=”_blank” link is protected against Tabnabbing by default.
Does this mean we can stop using the attribute?
No. Professional developers continue to explicitly write rel=”noopener” for three reasons:
- Legacy Support: Not all users update their browsers. A user on an older corporate machine or an outdated tablet may still be vulnerable without the explicit tag.
- Explicit Intent: Writing the code makes it clear to other developers that security was considered.
- Audit Tools: Performance tools like Google Lighthouse may still flag the code as “unsafe” if the attribute is missing, lowering the site’s “Best Practices” score.
Security Deep Dive: Privacy vs. Analytics
While noopener is purely a security and performance fix, noreferrer enters the complex realm of data privacy and marketing analytics. The decision to use noreferrer should not be automatic; it requires a strategic choice.
The “Referrer” Leak
When a user clicks a link from a secure area of a website—for example, a password reset page https://mysite.com/reset-password?token=12345—that URL contains sensitive information. If the user clicks a link on that page to an external site, and noreferrer is NOT used, the destination site receives the full URL in the Referrer header. The admin of the external site could theoretically see the password reset token in their analytics logs.
For this reason, rel=”noreferrer” is mandatory when linking from:
- Secure user dashboards.
- Internal intranets.
- Email web-viewers.
- Password reset or account recovery pages.
The Analytics Trade-off
However, using noreferrer on public marketing pages has a downside. If you link to a partner’s website, or if you are an affiliate marketer sending traffic to a merchant, you want them to know the traffic came from you.
- The Problem: If you use rel=”noreferrer”, the partner sees your traffic as “Direct/Unknown.” They cannot verify that you are sending them customers.
- The Balance: In these cases, use rel=”noopener” (for security) but omit noreferrer (to preserve analytics data).
- Code: <a href=”…” target=”_blank” rel=”noopener”>Partner Link</a>.
The nofollow Attribute: A Distinct Entity
Learners often confuse noopener with nofollow. They are unrelated.
- noopener: Tells the browser not to let the pages communicate (Security).
- nofollow: Tells search engines (like Google) not to count the link as a “vote” of confidence (SEO).
If you are linking to a sponsored product or an untrusted source, you might use all three:
<a href=”…” rel=”nofollow noopener noreferrer”>.
User Experience (UX) and Accessibility
Beyond the technical implementation, the way links behave defines the “feel” of a website. The debate between opening links in the same tab versus a new tab is a central topic in User Experience (UX) design.
The Principle of User Agency
The overarching rule of web accessibility is that the user should be in control of the interface. When a designer forces a link to open in a new tab, they are overriding the user’s preference.
- The “Back” Button: The “Back” button is the safety net of the internet. It is the most used navigation feature in the browser. When a new tab opens, the history is reset. If a user gets confused and clicks “Back,” nothing happens. This causes “disorientation,” a state where the user loses their mental map of where they are in the site structure.
- Power Users: Experienced users know they can “Ctrl+Click” (Windows) or “Cmd+Click” (Mac) to open any link in a new tab if they choose to. Forcing the behavior removes this choice.
WCAG Guidelines: The Requirement to Warn
The Web Content Accessibility Guidelines (WCAG), the international standard for web accessibility, discourage opening new windows/tabs unless necessary. Technique G200 states that if a link must open in a new window, the user must be warned in advance.
Ideally, this warning is part of the link text:
“Read our Privacy Policy (opens in a new tab)”
However, designers often find this text cluttered. A common compromise is to use a visual icon (an arrow pointing out of a square). But for blind users relying on screen readers, a visual icon is invisible. Therefore, developers must use ARIA (Accessible Rich Internet Applications) code or hidden text to announce the behavior.
Accessibility Best Practice Code:
HTML
See the Pen Link Attributes by deepak mandal (@deepak379) on CodePen.
This ensures that a blind user hears: “Link, External Site, opens in a new tab.” Without this, they might click, find themselves in a new window, and not understand why their “Back” keyboard shortcut is failing.
Mobile UX: The “Tab Trap”
On mobile devices, the issues with target=”_blank” are amplified significantly.
- Invisible Tabs: Mobile browsers (like Safari on iOS or Chrome on Android) often hide the tab bar to save screen space. When a new tab opens, the animation is subtle. Users often do not realize they have moved to a new tab. They may hit the “Back” button on their phone, which might close the browser app entirely rather than taking them back to the previous page.
- Resource Hoarding: Mobile devices have limited memory (RAM). Every open tab consumes memory. If a user unknowingly opens ten tabs because every link forces a new one, the phone may slow down, or the operating system may forcibly close the original tab in the background to save memory. When the user finally tries to return to the original tab, the page reloads from scratch, losing their place.
- Touch Targets: Mobile users operate with thumbs, not precise mouse cursors. Links need to be large enough to tap accurately. If a link opens a new tab, it should be visually distinct so the user can anticipate the interaction.
Mobile Recommendation: On mobile-responsive views, it is often better to avoid target=”_blank” entirely. Instead, consider using “Off-canvas” navigation or “Modal Windows” (popovers) to show content like help text or privacy policies without leaving the current page context.
Beyond Navigation: download and mailto
While the focus so far has been on navigation, links can also serve as functional tools for file management and communication.
The download Attribute
Introduced in HTML5, the download attribute transforms a link from a “navigator” into a “deliverer.”
- The Function: When a user clicks <a href=”report.pdf” download>, the browser bypasses its built-in PDF viewer and immediately prompts the user to save the file to their device.
- Renaming Capabilities: A powerful feature of this attribute is the ability to rename the file on the fly. Often, files on a server have ugly, system-generated names like scan_2023_v2_x899.pdf.
- By using <a href=”scan_2023_v2_x899.pdf” download=”My_Tax_Return.pdf”>, the developer ensures the file is saved with a clean, human-readable name.
- Security Restrictions: To prevent malicious sites from forcing you to download files from other websites (e.g., forcing you to download a banking statement from your bank), the download attribute only works for Same-Origin URLs. The file must be hosted on the same domain as the website, or it must be a blob: or data: URL generated by the site itself.
The mailto Protocol
The mailto: link is one of the oldest features of the web, allowing a link to open an email client rather than a webpage.
- Syntax: <a href=”mailto:user@example.com”>Email Us</a>
- Advanced usage: You can pre-fill the subject line and body text to help the user structure their message.
- Code: mailto:support@company.com?subject=Help&body=I%20have%20an%20issue…
- The Desktop vs. Mobile Divide:
- On Desktop: mailto links are frequently problematic. If the user uses Gmail in a browser but has not configured their computer’s default “Mail” app, clicking the link might open a setup wizard for Apple Mail or Outlook, which the user never uses. This is a high-friction “dead end”.
- On Mobile: mailto works exceptionally well. Tapping the link almost always successfully switches to the default Gmail or Mail app on the phone.
- Best Practice: Never rely solely on a mailto link. Always display the email address in plain text so the user can copy and paste it if the link fails.
Summary Comparison Table: Attribute Strategies
The following table summarizes the strategic application of these attributes based on the use case.
| Scenario | Recommended Attributes | Rationale |
| Standard Navigation (Internal Link) | (None) / target=”_self” | Keeps user in the same tab. Preserves “Back” history. Best for mobile. |
| External Link (e.g., Source citation) | target=”_blank” rel=”noopener” | Opens new tab to keep original site open. noopener prevents security/performance risks. |
| Sensitive External Link (e.g., from Dashboard) | target=”_blank” rel=”noopener noreferrer” | Hides the internal URL (referrer) from the destination for privacy. |
| File Download (PDF, Zip) | download | Forces file save instead of browser rendering. Best for non-navigable assets. |
| Email Contact | href=”mailto:…” | Opens native email client. Note: Always provide text backup. |
| Help/Terms while in Form | target=”_blank” rel=”noopener” | Critical to prevent data loss by keeping the form open in the original tab. |
The modern hyperlink is not a simple pointer; it is a complex instruction set that orchestrates the interaction between the user, the browser, and the operating system. The days of simply writing <a href=”…”> and hoping for the best are over.
For the professional web architect, “controlling the click” means balancing three competing priorities:
- Security: Preventing malicious actors from hijacking the user’s session via window.opener.
- Performance: ensuring that opening a new tab does not degrade the responsiveness of the original page by leveraging process isolation.
- User Experience: Respecting the user’s mental model of navigation, preserving their history stack, and providing clear warnings when a context switch is necessary.
By strictly adhering to the use of rel=”noopener”, judiciously applying target=”_blank”, and understanding the mobile implications of tab management, we can build a web that is not only interconnected but also safe, fast, and respectful of the user’s journey.

Leave a Reply