Cross-Origin-Opener-Policy
response headersecurity
Isolates your page from cross-origin windows that open it or that it opens.
When one page opens another with window.open, the two normally keep references to each other. COOP set to same-origin cuts that link for cross-origin windows, which protects against attacks that probe or navigate your window. Together with Cross-Origin-Embedder-Policy it enables cross-origin isolation, which unlocks SharedArrayBuffer and high-resolution timers.
Syntax
Cross-Origin-Opener-Policy: unsafe-none | same-origin-allow-popups | same-origin
Defined in HTML Standard — Cross-origin opener policies.
Values
| unsafe-none | the default: no isolation |
|---|---|
| same-origin-allow-popups | isolate from cross-origin openers, but keep references to popups this page opens |
| same-origin | isolate from all cross-origin windows |
Examples
Cross-Origin-Opener-Policy: same-origin
full isolation from cross-origin windows
Cross-Origin-Opener-Policy: same-origin-allow-popups
keeps sign-in and payment popups working
Good to know
same-originbreaks popups that report back throughwindow.opener, such as many OAuth and payment flows — usesame-origin-allow-popupson the page that opens them.crossOriginIsolatedrequires both COOPsame-originandCross-Origin-Embedder-Policy: require-corp(orcredentialless).
Further reading: Security headers checklist · Security headers generator
How to set Cross-Origin-Opener-Policy
res.set("Cross-Origin-Opener-Policy", "same-origin");module.exports = {
async headers() {
return [
{
source: "/(.*)",
headers: [{ key: "Cross-Origin-Opener-Policy", value: "same-origin" }],
},
];
},
};add_header Cross-Origin-Opener-Policy "same-origin" always;
Header always set Cross-Origin-Opener-Policy "same-origin"
Check it
Fetch only the response headers and filter for Cross-Origin-Opener-Policy. In the browser, it's under Response Headers in DevTools → Network.
curl -sI https://example.com/ | grep -i '^cross-origin-opener-policy:'
To compare response headers across many URLs at once, use the HTTP Status Checker.
Frequently asked questions
Why did my login popup stop working?
With COOP same-origin, the popup loses its window.opener reference and can't pass the result back. Use same-origin-allow-popups on the page that opens it.