On this page
When a link opens a new tab, the page that opens it may be able to interact with the original page through window.opener. The rel="noopener" attribute prevents that connection from being available to the newly opened page. This article explains the risk, how noopener differs from noreferrer, and what to use for links with target="_blank".
Key Takeaways
rel="noopener"prevents the new page from accessing its opener throughwindow.opener, reducing the risk of reverse tabnabbing.- Modern browsers generally treat
target="_blank"links as if they hadrel="noopener". Writing the attribute explicitly can still make intent clear and help with older browser support. noopenerdoes not suppress the HTTP referrer.noreferrerdoes, and also impliesnoopener.- Neither attribute makes a destination trustworthy or replaces other link and application security measures.
The risk: a new page can affect its opener
A page opened in a new browsing context has historically been able to receive a reference to the page that opened it. In a link opened with target="_blank", the new page could use window.opener to interact with the original tab.
That interaction is subject to browser security rules, but it can still create a practical phishing risk: a destination may navigate the original tab to a different page. The visitor could return to what looks like the original site and encounter a convincing sign-in prompt on a page controlled by someone else. This technique is commonly called reverse tabnabbing.
rel="noopener" tells the browser not to provide the opened page with an opener reference. In that context, the new page's window.opener is null, so it cannot use that reference to navigate or otherwise interact with the original tab.
Advertisement
Add noopener to links that open a new tab
A straightforward pattern is:
<a href="https://example.com/" target="_blank" rel="noopener">
Open Example in a new tab
</a>
The target="_blank" requests a new browsing context. The rel="noopener" value isolates it from the opening page. Use a real destination in your application, and make the link text clear about where it leads or that it opens a new tab when that information matters to users.
What modern browsers do with _blank
Modern browsers generally give links with target="_blank" the same opener protection as rel="noopener", even when the attribute is omitted. That default reduces the need for the attribute as a security fix in current browsers. Explicitly including it remains a useful way to communicate the intended behavior and account for older browser versions or embedded webviews with different behavior.
This is a version-sensitive platform behavior. Live documentation retrieval was unavailable while preparing this article, so check the current HTML Standard and the browser versions your application supports before relying on a particular compatibility baseline.
noopener versus noreferrer
These values address related but different concerns:
| Attribute value | Prevents access through window.opener | Suppresses the HTTP Referer header |
|---|---|---|
noopener | Yes | No |
noreferrer | Yes | Yes |
Use noopener when the goal is to isolate the newly opened page but you still want normal referrer behavior. Use noreferrer when you also want the destination not to receive referrer information. Referrer data can be relevant to analytics, attribution, and security monitoring, so suppressing it should be a deliberate choice.
For example, this link requests both protections because noreferrer includes the opener protection as well:
<a href="https://example.com/" target="_blank" rel="noreferrer">
Open Example without sending referrer information
</a>
A site can also control referrer information with a referrerpolicy attribute or an HTTP policy. Choose the mechanism that matches the actual requirement; do not add noreferrer automatically if the only concern is window.opener.
Common Mistakes
- Assuming
noopenerhides the destination URL. It does not. The link still navigates to the URL inhref. - Using
noreferrerwhen only opener isolation is needed. This can remove referrer information that the destination or your analytics workflow expects. - Treating a safe-looking link as a trusted destination.
noopenerlimits a relationship between browsing contexts; it does not prevent phishing, malicious downloads, or unsafe content on the destination. - Relying on a hostname check as complete link security. If an application accepts user-supplied URLs, validate and handle them according to the application's threat model.
rel="noopener"is not URL validation. - Assuming the attribute protects every way a page can be opened. Review JavaScript calls such as
window.open()separately and use the appropriate features and policies for that code path.
Best Practices
- Add
rel="noopener"to links usingtarget="_blank"when you want explicit opener isolation, especially when supporting older or embedded browsers. - Add
noreferreronly when withholding referrer information is also intentional. - Keep link text and destination behavior understandable, including when a link opens a new tab.
- Review the destination and the way your application accepts URLs independently of opener protection.
- Test the behavior in the browsers and webviews you actually support.
Conclusion
rel="noopener" prevents a newly opened page from using window.opener to affect the page that opened it. Modern browsers generally apply this protection to target="_blank" already, but an explicit attribute can document intent and support older environments. Use noreferrer only when suppressing referrer information is part of the requirement, and treat both attributes as narrow protections rather than complete link security.
References
Live source retrieval was unavailable for this draft, so current documentation could not be checked and verified here. Consult the current HTML Standard and browser documentation before using version-specific compatibility claims in production guidance.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.