🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
HTML MASTER CLASS /// LEARN TAGS /// BUILD STRUCTURE /// SEMANTIC WEB /// HTML MASTER CLASS /// LEARN TAGS ///

rel="noopener noreferrer": Understanding The Real Vulnerability

Understand exactly how window.opener creates a live reference enabling the reverse tabnabbing attack, walk through the real attack scenario, and learn the precise difference between what noopener and noreferrer each actually do.

Total XP: 0|💻 html XP: 0

Skill Matrix

UNLOCK NODES BY LEARNING NEW TAGS.

noopener noreferrer

The real vulnerability, explained.


🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

The previous lesson established rel="noopener noreferrer" as a checklist rule to always pair with target="_blank". This lesson explains the actual mechanism and named attack — reverse tabnabbing — that makes this rule genuinely necessary, not just conventional.

1window.opener: A Live Reference Back

When a page opens a new tab via target="_blank" (or window.open()), the newly opened page's JavaScript automatically receives window.opener — a genuine, live reference to the original tab's window object. Critically, this includes the ability to set window.opener.location, which silently navigates the *original* tab to any URL the new page's JavaScript chooses, with zero warning or user interaction required in the original tab.

This is the specific, concrete technical mechanism underlying the checklist rule from the previous lesson — without blocking it, any link using target="_blank" to an untrusted or externally-controlled destination hands that destination real, exploitable power over the tab the user came from.

// In the newly opened tab's JavaScript (attacker-controlled):
window.opener.location = 'https://phishing-site.example.com';
// The ORIGINAL tab silently navigates, with no visible warning
localhost:3000
⚠ Real, Exploitable Accesswindow.opener grants genuine control over the original tab's location, not a theoretical risk.

2The Full Reverse Tabnabbing Attack Scenario

This vulnerability has a specific, documented name: 'reverse tabnabbing'. The attack sequence: a user clicks a link on a legitimate site that opens, via target="_blank", an attacker-controlled destination in a new tab. The user's attention naturally follows to that new tab. Meanwhile, the attacker's page JavaScript silently redirects the *original* tab — out of the user's current view — to a convincing fake login page mimicking a real, trusted service (a bank, an email provider, the original site itself).

When the user eventually switches back to what they believe is still the original, trusted tab, they instead see a phishing page and, trusting it precisely because it's 'the tab I had open before', may enter real credentials directly into the attacker's fake form.

// Attack sequence:
// 1. Link opens attacker's page in a new tab (target="_blank")
// 2. Attacker's JS silently redirects the ORIGINAL tab
// 3. User returns to original tab, sees a convincing fake login page
localhost:3000
⚠ A Real, Named Phishing TechniqueReverse tabnabbing exploits user trust in a tab they didn't watch change.

3What noopener And noreferrer Each Precisely Do

rel="noopener" specifically sets window.opener to null in the newly opened tab, completely and directly blocking the mechanism described above — the new page simply has no reference back to the original tab at all, making the attack technically impossible.

rel="noreferrer" provides that identical protection (also nulling window.opener) but goes further: it additionally omits the Referer HTTP header that would otherwise tell the destination site which page linked to it, an added privacy benefit unrelated to the tabnabbing vulnerability itself. Since noreferrer is a strict superset of noopener's protection plus this additional privacy benefit, using both together — rel="noopener noreferrer" — is the common, comprehensive, safe default recommendation, with the redundancy also serving as a compatibility fallback across different browser support levels.

<a href="..." target="_blank" rel="noopener noreferrer">Link</a>
localhost:3000
noopener →
window.opener = null (blocks the attack)
noreferrer →
same protection + hides the Referer header

4Step-by-Step Breakdown

The Mechanism Behind The Attribute You Always Add. The previous lesson established that target="_blank" always needs rel="noopener noreferrer" as a checklist rule. This lesson explains exactly why: the specific window.opener mechanism that creates a real vulnerability called 'reverse tabnabbing', and precisely what each half of that rel value actually does.

window.opener Gives The New Tab A Reference Back. When a link with target="_blank" opens a new tab, that new page's JavaScript receives window.opener — a live reference back to the original tab's window object, letting the new (potentially malicious) page manipulate the original tab's location.

The window.opener Mechanism. What does window.opener give a page opened via target="_blank" access to?

  • Direct read access to the original tab's cookies
  • A live JavaScript reference to the original tab's window object, including its location
  • Nothing meaningful; it's just a boolean flag

Reverse Tabnabbing: The Actual Attack Scenario. A legitimate-looking site includes an external link (target="_blank" to an attacker-controlled destination). Once opened, that destination's JavaScript silently redirects the ORIGINAL tab — which the user isn't looking at anymore — to a convincing fake login page mimicking a real service, phishing for credentials.

The Reverse Tabnabbing Attack. In a reverse tabnabbing attack, which tab does the user actually notice being manipulated?

  • The newly opened tab, which visibly changes
  • Neither directly — the ORIGINAL tab is silently redirected while the user's attention is on the new one
  • Both tabs flash a visible warning simultaneously

noopener Blocks Access, noreferrer Also Hides Origin. rel="noopener" specifically sets window.opener to null in the new tab, completely blocking the attack mechanism. rel="noreferrer" does that too, AND additionally omits the Referer header, preventing the destination from even knowing what page linked to it — a privacy bonus beyond the core security fix.

noopener vs noreferrer. What does rel="noreferrer" do beyond what rel="noopener" alone already accomplishes?

  • Nothing; they're functionally identical in every way
  • It also omits the Referer header, preventing the destination from knowing which page linked to it
  • It forces the link to open in the same tab instead of a new one

The Full Mechanism Understood. You now understand exactly why the checklist rule from the previous lesson exists: the window.opener mechanism enabling reverse tabnabbing, the real attack scenario it powers, and the precise, distinct effects of noopener versus noreferrer — completing the HTML Security module.

Fully Secure An External Link. noopener blocks window.opener access; noreferrer additionally hides the referrer header.

Level Up 🚀

Advanced cheat sheets, SEO tricks, and interview prep for this topic.

Browser Support

ChromeSupported

Fully supported.

FirefoxSupported

Fully supported.

SafariSupported

Fully supported.

EdgeSupported

Fully supported.

Accessibility (A11y)

1Understanding The Real Mechanism Reinforces Why This Isn't An Optional Convention

Recognizing reverse tabnabbing as a genuine, exploitable phishing technique — not just a stylistic best practice — helps teams correctly prioritize consistently applying this protection across an entire codebase.

SEO Implications

  • 1

    This Attribute Pairing Has No Direct SEO Weight But Protects Against A Reputationally Damaging Phishing Vector

    A site whose links are exploited for reverse tabnabbing phishing attacks, even against third-party destinations, faces genuine reputational and trust damage if discovered and publicized.

Best Practices

Use rel="noopener noreferrer" (Both Values Together) As The Default For Any target="_blank" Link To An External Destination

noreferrer's protection is a strict superset of noopener's, and combining both provides the most comprehensive, broadly-compatible protection against reverse tabnabbing plus an added referrer-privacy benefit.

Apply This Protection Consistently Across An Entire Codebase, Not Just Obviously Untrusted Links

Since window.opener grants real access regardless of how trustworthy a destination currently appears, and destinations can change ownership or be compromised later, consistent application is safer than case-by-case judgment calls.

Frequent Bugs

THE BUG

A security audit flags numerous target="_blank" links across a site missing rel="noopener".

THE FIX

Add rel="noopener noreferrer" consistently to every target="_blank" link pointing to an external destination.

THE BUG

A team debates whether noopener alone is 'good enough' compared to noopener noreferrer.

THE FIX

Use both together as the standard default — noreferrer's protection is a superset of noopener's, with the added referrer-privacy benefit costing nothing extra to include.

Real-World Examples

A Correctly Protected External Link

A blog post's external citation link, fully protected against reverse tabnabbing.

<a href="https://external-source.example.com/article" target="_blank" rel="noopener noreferrer">
  Read the original source
</a>

Interview Prep

?Frequently Asked Questions

Pascual Vila

Pascual Vila

Frontend Instructor // Code Syllabus

Common Pitfalls & Errors

The Error //

Using target="_blank" without any rel protection

<a href="..." target="_blank" rel="noopener noreferrer">

The Solution //

Always add rel="noopener noreferrer" to target="_blank" links to external destinations.

The Error //

Using window.open() without the equivalent noopener protection

window.open(url, '_blank', 'noopener,noreferrer');

The Solution //

Include 'noopener' in the window.open() features string as well.

Lesson Glossary

[01]window.opener

A live JS reference from a new tab back to its opener.

Code Preview
Enables reverse tabnabbing if unblocked

[02]Reverse Tabnabbing

A phishing attack silently redirecting the original tab.

Code Preview
The named vulnerability this fixes

[03]rel="noopener"

Sets window.opener to null, blocking the attack.

Code Preview
The core security fix

[04]rel="noreferrer"

Same protection as noopener, plus hides the Referer header.

Code Preview
Security + privacy

Continue Learning