Tabnabbing Fix: target="_blank" and rel="noopener" Explained (2026)

Our scanner flags a Tabnabbing Risk whenever your homepage has a link with target="_blank" and no rel="noopener" or rel="noreferrer". It's a low-severity finding, and that rating is honest. Since early 2021 every major browser blocks the classic version of this attack by default.

It's still worth the two minutes to fix. Old browsers don't have the default, window.open() doesn't get it, and the fix is one attribute.

TL;DR

Add rel="noopener noreferrer" to every target="_blank" link, and pass "noopener" as the third argument to window.open(). Chrome 88, Firefox 79 and Safari 12.1 already treat _blank links as noopener, so the remaining risk is mostly window.open() and older browsers.

What tabnabbing actually is

When a link opens a new tab, the old default gave that new page a handle back to yours through window.opener. The new page couldn't read your page, but it could navigate it:

What a malicious page could run (old browsers, or after window.open)
// runs on the page your link opened
if (window.opener) {
  window.opener.location = 'https://yourapp-login.example/session-expired';
}

The visitor reads the new tab, switches back, and finds your app asking them to sign in again. Except it's a lookalike page, and the URL bar is the only clue. That's reverse tabnabbing: the tab they trusted got swapped while they weren't looking.

Why your browser mostly handles this already

The HTML spec changed so that target="_blank" implies noopener. Per MDN's compatibility data, that shipped in:

BrowserImplicit noopener since
Chrome (and Edge)88 (January 2021)
Firefox79 (July 2020)
Safari12.1 (March 2019)

So a plain <a href="..." target="_blank"> is safe for nearly everyone. What isn't covered:

  • window.open() returns a handle to the new window, and the new page gets window.opener unless you ask for noopener. This is the one we'd actually worry about in AI-generated code, because "open the share dialog in a new window" usually comes out as window.open(url).
  • rel="opener" turns the old behavior back on. You'd only see it if someone added it deliberately.
  • Old browsers, like embedded webviews and unpatched corporate machines.

Fix it in four steps

1

Find every new-tab link in your source. Run this from your project root:

grep -rnE "target=[\"'{]*_blank" src app components pages 2>/dev/null \
  | grep -v noopener | grep -v noreferrer

Every line it prints is a link to fix. Also search for window.open(.

2

Add the rel attribute. In plain HTML, JSX or a Next.js <Link>:

<a href="https://partner.example" target="_blank" rel="noopener noreferrer">Partner</a>

Pick rel="noopener" alone if you want the linked site to see your domain as the referrer (affiliate and partner links often do). Both values cut off window.opener, because noreferrer implies noopener.

3

Fix window.open() calls. Pass noopener in the features string:

// before
window.open(shareUrl, '_blank');

// after
window.open(shareUrl, '_blank', 'noopener,noreferrer');

With noopener, window.open() returns null. If your code used the return value (to focus the window or close it later), that code now needs a different approach, so test the button after the change.

4

Stop new ones arriving. In a React project, turn on the eslint-plugin-react rule:

{
  "rules": {
    "react/jsx-no-target-blank": "error"
  }
}

It fails the lint when a target="_blank" link has no rel="noreferrer". Add a line to your AI tool's rules file too ("every external link with target=_blank gets rel=noopener noreferrer"), since that's where most of these come from.

Why the finding can survive your fix

Our check reads the HTML your server returns for the homepage, then counts <a> tags with target="_blank" whose tag contains neither noopener nor noreferrer. A few things follow from that:

  • Links from a CMS, a footer widget or an embed count too. If your source is clean but the finding stays, view source on the live page and search for _blank.
  • Links rendered only in the browser (a client-side React app that ships an empty <div id="root">) aren't in that HTML, so the scan can't see them. A clean result there doesn't prove your app is clean. Run the grep in Step 1.
  • The scan covers your homepage, not every page. Treat a finding as a pointer to a pattern in your codebase, not a full list.

Don't spend long here if you have a high-severity finding open. A leaked API key or a database readable by anyone is a real breach today. Tabnabbing is a cleanup item.

Is tabnabbing still a risk in 2026?

Much less than it used to be. Chrome 88, Firefox 79 and Safari 12.1 treat any target="_blank" link as if it had rel="noopener", so the new tab gets no handle back to your page. The risk that's left is window.open() called without the noopener feature, links that explicitly set rel="opener", and visitors on very old browsers.

Should I use noopener or noreferrer?

noopener cuts the new tab's access to your page. noreferrer does that too and also strips the Referer header, so the site you link to can't see where the visitor came from. Use noopener if you want partners to see your traffic in their analytics, or noopener noreferrer if you don't.

Why does my scanner still flag links after I added rel?

Our check reads the HTML your server sends for the homepage and counts target="_blank" links whose rel contains neither noopener nor noreferrer. If the flagged links are in a CMS block, a footer component or a third-party embed, they're coming from somewhere you didn't edit. View source on the live page and search for _blank.

Does React or Next.js add noopener automatically?

No. A <Link target="_blank"> or <a target="_blank"> renders exactly the attributes you give it. Modern browsers still apply the implicit noopener, but the HTML stays flagged. The eslint-plugin-react rule react/jsx-no-target-blank catches these at lint time.

Find out whether your homepage has unsafe new-tab links, along with the higher-severity problems worth fixing first.

How-To Guides

Tabnabbing Fix: target="_blank" and rel="noopener" Explained (2026)