On this page
A link to about:blank can open a new tab that retains a reference to the page that opened it. That relationship matters if the new tab is later navigated to content you do not control: the new page may be able to navigate the original tab, even when cross-origin restrictions prevent it from reading the original page.
This guide shows how to review about blank link opener security and test the relationship locally. Browser documentation and the examples could not be checked in this run, so verify the behavior in the browsers and versions your app supports.
Key Takeaways
- Use
rel="noopener"on links opening a new context when that context does not need access to its opener. rel="noreferrer"also suppresses theRefererheader; choose it for that additional privacy behavior, not as an interchangeable spelling without considering the trade-off.about:blankis not inherently unsafe. The risk depends on the opener relationship and what content the new context can eventually load.- Test the actual link and navigation flow in each supported browser. One browser result is not a universal guarantee.
How an opener relationship creates risk
Consider this link:
<a href="about:blank" target="_blank" rel="opener">
Open a blank tab with an opener
</a>
If the browser honors the explicit opener relationship, JavaScript in the new tab can refer to the original window through window.opener. This example intentionally requests that relationship for demonstration; it is not the safer default to copy into an app.
A newly opened blank document commonly inherits its creator's origin. While it remains same-origin, it may be able to access more of the opener than a cross-origin page could. The exact result can depend on the browser and isolation settings. After navigation to a different origin, same-origin restrictions normally prevent reading the opener's document, but a cross-origin page may still be able to navigate the opener. Such navigation can be used for tabnabbing: replacing the original page with a deceptive one.
The safer link when the new context does not need its opener is:
<a href="about:blank" target="_blank" rel="noopener">
Open a blank tab without an opener
</a>
Modern browsers may implicitly apply noopener behavior to target="_blank" links, but do not assume a particular default across every browser and embedded webview you support. Declaring noopener makes the intended relationship explicit.
Advertisement
Test opener access and navigation locally
This test uses only a local server and a local destination. It requires Python, a browser with developer tools, and permission for the page to open new tabs. The code has not been executed for this article.
- Create a directory and save this as
index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Opener test</title>
</head>
<body>
<h1>Local opener test</h1>
<p><a href="about:blank" target="_blank">Default behavior</a></p>
<p><a href="about:blank" target="_blank" rel="opener">Explicit opener</a></p>
<p><a href="about:blank" target="_blank" rel="noopener">Explicit noopener</a></p>
</body>
</html>
- In the same directory, save a local navigation target as
destination.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Local destination</title>
</head>
<body>
<h1>Local navigation destination</h1>
</body>
</html>
- From that directory, start the server:
python3 -m http.server 8000 --bind 127.0.0.1
- Open
http://127.0.0.1:8000/index.html. Click Explicit opener, switch to the new blank tab, and open developer tools for that tab—not for the original tab. In its console, enter:
window.opener
A non-null window reference indicates an opener is exposed. If it is null, the browser or its configuration did not expose one in this test. To check whether the blank tab can read the original page's URL, enter:
try {
console.log(window.opener ? window.opener.location.href : 'No opener');
} catch (error) {
console.log('Opener URL could not be read:', error.name);
}
- Still in the blank tab's console, try navigating the opener to the local destination:
if (window.opener) {
window.opener.location.href = 'http://127.0.0.1:8000/destination.html';
} else {
console.log('No opener to navigate');
}
If navigation is allowed, the original tab should display the local destination. Return it to index.html before repeating the test with Default behavior and Explicit noopener. For the latter, the intended result is a null opener and no opener navigation. Stop the server with Ctrl+C when finished.
Record the browser name, version, and any relevant settings alongside the results. Popup blocking, sandboxing, browser policies, and document isolation can affect a test. This local test also does not prove what a later cross-origin page can read or navigate; test the actual deployment flow separately in an authorized environment.
Review script-created windows too
Links are not the only way to create a browsing context. For a script that does not need to control the opened window, request noopener behavior when opening it:
window.open('about:blank', '_blank', 'noopener');
Call this in an appropriate user-interaction flow, since browsers may block popups. Do not interpret a null return value alone as proof that a popup was blocked: noopener can also prevent the caller from receiving a usable window reference. If your app must communicate with a new window, design and test that relationship deliberately rather than removing opener isolation without considering the content that can be loaded there.
Advertisement
Common Mistakes
- Checking only the initial blank page. Follow the full flow: a blank tab can later navigate, and its opener relationship may still matter.
- Assuming cross-origin means no risk. Reading another origin's document and navigating a window are different operations.
- Testing the wrong console. Evaluate
window.openerin the newly opened tab. The original tab's value answers a different question. - Using
noreferrerwithout considering analytics or application requirements. It changes referrer behavior in addition to affecting the opener relationship. Anabout:blanknavigation itself does not make a network request, so this test does not demonstrate aRefererheader. - Treating one result as universal. Browser versions, webviews, sandbox attributes, and isolation policies can change behavior. This article does not claim current compatibility for any particular browser.
Best Practices
- Inventory links and scripts that open new contexts, including flows that start at
about:blankand navigate later. - Prefer explicit
rel="noopener"for links that do not need an opener, and test script-created windows separately. - If an opener is necessary, restrict and review what the new context can load and what it can do with the original window. Consider the effects of sandboxing and cross-origin isolation policies on your specific flow.
- Include supported browsers and embedded webviews in release checks. Recheck after changes to navigation, security headers, or browser support.
Conclusion
Before publishing, inspect both the initial about:blank opening and any later navigation. Explicitly sever the opener where it is not needed, then verify the behavior in the environments your app actually supports.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.