Cross-Origin-Opener-Policy
COOP isolates your browsing context from cross-origin documents, preventing certain cross-origin attacks.
Results in 1–3 minutes · Free · No signup required
Why It Matters
Prevents cross-origin documents from accessing your window object, protecting against certain side-channel attacks and window.opener exploits.
How We Check
We verify COOP header presence and check for secure values like same-origin or same-origin-allow-popups.
Good vs Bad Values
| Value | Verdict | Why |
|---|---|---|
Cross-Origin-Opener-Policy: same-origin | Good | The page lives in its own browsing context group. Cross-origin windows lose `window.opener` and cannot reach it. Required for cross-origin isolation. |
Cross-Origin-Opener-Policy: same-origin-allow-popups | Good | Keeps the page isolated from cross-origin openers but lets it keep control of popups it opens that do not set a conflicting policy. A fit for OAuth and payment popups. |
Cross-Origin-Opener-Policy: noopener-allow-popups | Weak | A newer value that severs the opener relationship for pages opening this one while keeping popups usable. The scanner accepts it, but support is recent, so check your target browsers. |
Cross-Origin-Opener-Policy-Report-Only: same-origin | Weak | Reports what would break without enforcing it. Useful for staging, not a protection. |
Cross-Origin-Opener-Policy: unsafe-none | Bad | The default, written out. The page shares a browsing context group with cross-origin windows. |
Cross-Origin-Opener-Policy: same_origin | Bad | A typo with an underscore. Unknown values are ignored, so the page has no policy. |
Cross-Origin-Opener-Policy: same-site | Bad | There is no same-site value for COOP (it exists for CORP). It is invalid here. |
Header missing | Bad | Browsers apply unsafe-none. A page that opened yours, or one you opened, can reach your window object. |
How to Fix
Add Cross-Origin-Opener-Policy: same-origin for full isolation. Use same-origin-allow-popups if you need popup functionality.
Nginx:
add_header Cross-Origin-Opener-Policy "same-origin" always;
Apache (requires mod_headers):
Header always set Cross-Origin-Opener-Policy "same-origin"
Next.js — next.config.js, with a relaxed policy for the routes that open third-party popups. When several entries match a path, make sure the exceptions do not send a second conflicting value:
async headers() {
return [
{
// every route except /checkout
source: "/((?!checkout).*)",
headers: [{ key: "Cross-Origin-Opener-Policy", value: "same-origin" }],
},
{
source: "/checkout/:path*",
headers: [{ key: "Cross-Origin-Opener-Policy", value: "same-origin-allow-popups" }],
},
];
}
Express with Helmet: helmet.crossOriginOpenerPolicy({ policy: "same-origin" }); this is on by default in recent Helmet versions. Cloudflare: Transform Rule → Modify Response Header → Set static.
Stage it with Cross-Origin-Opener-Policy-Report-Only: same-origin; report-to="coop" and a Reporting-Endpoints header. The reports list navigations and popups that would lose their opener relationship.
Test checklist: sign in with Google, GitHub or SSO; pay with Stripe, PayPal or Polar if they use popups; any window.open that expects a reply through postMessage; and any link from another origin that opens your page with target="_blank".
Verify with curl -sI https://example.com | grep -i cross-origin-opener-policy. In DevTools → Application → Frames, the Cross-Origin Isolation section shows the active COOP value.
Common Mistakes
- Setting `same-origin` and breaking sign-in flows. OAuth and payment popups use `window.opener` to send results back; with `same-origin` that link is cut. Use `same-origin-allow-popups` or switch to redirect flows.
- Sending it on subresources or API responses. COOP is read from top-level documents (and popups); on images, scripts or JSON it does nothing.
- Applying it only to some pages. A popup or navigation lands in a new browsing context group whenever the two pages disagree, so a half-applied rollout produces intermittent breakage.
- Expecting COOP alone to give cross-origin isolation. You also need `Cross-Origin-Embedder-Policy`; the combination is what turns on `crossOriginIsolated`.
- Using `window.open` plus `postMessage` between your own subdomains. Subdomains are different origins; with `same-origin` they end up in separate groups and stop communicating.
- Forgetting that analytics and chat widgets that open popups may rely on the opener relationship. Test their flows.
Frequently Asked Questions
What is Cross-Origin-Opener-Policy?
COOP isolates your browsing context from cross-origin documents, preventing certain cross-origin attacks.
Why does Cross-Origin-Opener-Policy matter for website security?
Prevents cross-origin documents from accessing your window object, protecting against certain side-channel attacks and window.opener exploits.
How do I fix Cross-Origin-Opener-Policy issues?
Add Cross-Origin-Opener-Policy: same-origin for full isolation. Use same-origin-allow-popups if you need popup functionality.
Related Security Checks
Check Your Website Now
Run a free security scan to check for Cross-Origin-Opener-Policy issues and 61 other security checks.
Scan Your Website Free