Embed a site in an iframe while testing: remove X-Frame-Options and frame-ancestors
To load a page in your iframe when it refuses to be framed, remove two response headers from that page: X-Frame-Options and Content-Security-Policy. In HeaderDial that is two remove rows, limited to the framed site's domain. Removing only X-Frame-Options is not enough when the page also sends a CSP frame-ancestors directive. In our tests the frame stayed blocked in both Chrome and Firefox until both headers were gone. Use this only on sites you are testing.
The errors this fixes
Chrome 159 logged these in the Console of the parent page. Chrome shows only the framed site's origin, and writes the value in lower case:
Refused to display 'https://example.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Refused to display 'https://example.com/' in a frame because it set 'X-Frame-Options' to 'deny'.
Framing 'https://example.com/' violates the following Content Security Policy directive: "frame-ancestors 'none'". The request has been blocked.
Many support threads quote the CSP error in another wording, for example this Atlassian article. It is the same block:
Refused to frame 'https://example.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
Firefox 158 logged these:
The loading of “https://example.com/page” in a frame is denied by “X-Frame-Options“ directive set to “sameorigin“.
Content-Security-Policy: The page’s settings blocked the loading of a resource (frame-ancestors) at <unknown> because it violates the following directive: “frame-ancestors 'none'”
The directive can also read frame-ancestors 'self' or name a list of sites. The fix is the same.
Steps
- Open HeaderDial and click + Response header. In the name field type
X-Frame-Options, then choose remove in the operation select (set / append / remove). - Click + Response header again and type
Content-Security-Policy. Choose remove. To keep the rest of the policy, leave the operation on set instead and paste the site's policy without theframe-ancestorspart as the value, for exampledefault-src 'self'. - Open Where it applies, click + Only on…, choose Domain and type the host of the page inside the iframe, for example
app.example.com. Not the host of your parent page: these headers come on the framed page's response. - In each row's expiry select, pick 15 min, 1 hour, 8 hours or 1 day. The rows then turn themselves off.
- Give HeaderDial site access when the banner asks, then reload the parent page.
Shortcut (HeaderDial 0.7.0): pick + Recipe… → Allow the site in an iframe. It adds both remove rows at once; then do steps 3 to 5.
If you ticked request types under Where it applies, include sub frame. An iframe's page is a sub_frame request, not a page load (main_frame). With no type ticked, the profile covers all types, and that works.
What we measured
Measured with HeaderDial 0.6.0 in Chrome for Testing 159.0.8154.6 and Firefox 158.0.1, 20 November 2026. A local server answered on both localhost and 127.0.0.1. The parent page on localhost framed a child page on 127.0.0.1, which is a different origin and a different site. The child page posts a message to the parent when its script runs. "Loads" means the parent got that message. "Blocked" means the server sent the page but its script never ran. Each case was run three times in each browser, with the same results.
| Child page sends | HeaderDial rule | Chrome 159 | Firefox 158 |
|---|---|---|---|
| nothing (control) | none | loads | loads |
X-Frame-Options: DENY | none | blocked | blocked |
X-Frame-Options: SAMEORIGIN | none | blocked | blocked |
X-Frame-Options: SAMEORIGIN, parent on the same origin | none | loads | loads |
X-Frame-Options: DENY or SAMEORIGIN | remove X-Frame-Options | loads | loads |
X-Frame-Options: DENY | set X-Frame-Options to ALLOWALL | loads | loads |
Content-Security-Policy: frame-ancestors 'none' (or 'self') | none | blocked | blocked |
frame-ancestors 'none' | remove X-Frame-Options only | blocked | blocked |
frame-ancestors 'none' | remove Content-Security-Policy | loads | loads |
default-src 'self'; frame-ancestors 'none' | set Content-Security-Policy to default-src 'self' | loads | loads |
both X-Frame-Options: DENY and frame-ancestors 'none' | remove X-Frame-Options only | blocked | blocked |
| both | remove Content-Security-Policy only | blocked | blocked |
| both | remove both | loads | loads |
X-Frame-Options: DENY and a frame-ancestors that lists the parent | none | loads | loads |
| both | remove both; request types: main frame only | blocked | blocked |
| both | remove both; request types: main frame, xmlhttprequest, script | blocked | blocked |
| both | remove both; request types: sub frame only | loads | loads |
| both | remove both; Only on Domain = the child's host | loads | loads |
| both | remove both; Only on Domain = the parent's host | blocked | blocked |
| both | remove both; Only on Page domain = the parent's host | loads | loads |
What this shows:
- A
frame-ancestorsdirective overridesX-Frame-Options. A page that sentDENYtogether with aframe-ancestorslist that included the parent loaded in both browsers. That is why removing onlyX-Frame-Optionsdoes nothing while the CSP still says'none'. Once the CSP is gone,X-Frame-Optionsapplies again, so remove both. ALLOWALLworks, but only by accident. It is not a validX-Frame-Optionsvalue, and Chromium's source says it ignores headers with values it does not recognise (ancestor_throttle.cc). remove says what you mean.- The rule must reach the framed page. A Domain filter on the child's host works. A Domain filter on your parent page's host does not. A Page domain filter on the parent's host also worked, because the parent page starts the iframe's request. It also changes every other request that page makes, so the child's Domain is the tighter choice.
- Scope a set rule. Without a filter, a replacement CSP also replaces the policy of your own parent page. In our first Chrome run that stopped the parent page's inline script from running.
Browsers do let extensions change these two response headers. For the headers they don't let you change, see Which HTTP headers browsers won't let an extension change.
Logged in on the site, but logged out in the frame
Once the frame loads, the site may not know you. We set four cookies by visiting the child site directly: SameSite=Lax, SameSite=Strict, no SameSite attribute, and SameSite=None; Secure. Then we loaded the site in the cross-site iframe and recorded which cookies the server received.
| Cookie | Chrome 159 | Firefox 158 |
|---|---|---|
Set on a direct visit with SameSite=Lax, Strict or no attribute | not sent in the frame | not sent in the frame |
Set on a direct visit with SameSite=None; Secure | sent | not sent |
Set by the page while it was in the frame, SameSite=Lax | not stored | not stored |
| Set by the page while it was in the frame, no attribute | not stored | stored, and sent only inside that frame |
| Same cookies, parent page on the same site as the child (control) | all sent | all sent |
| A HeaderDial + Cookie row set to Send, Only on Domain = the child's host | sent in the frame | sent in the frame |
Firefox sent no cookies at all from the direct visit, not even SameSite=None. That matches Firefox's separate cookie storage for each top-level site, which Mozilla calls Total Cookie Protection. To test a logged-in session inside the frame, add the session cookie with a + Cookie row set to Send and limit it to the child's domain. See how to send a cookie with requests.
Safety
X-Frame-Options and frame-ancestors protect against clickjacking: another site loading the page in an invisible frame and tricking you into clicking it. Remove them only on sites you are testing, keep the rule limited to that domain, and give each row an expiry. Turn the profile off with its Active switch when you are done.This changes only your own browser. Visitors still get the real headers. To let a page be embedded for real, the site has to send a frame-ancestors directive that lists the parent site. For the CSP itself, see How to modify Content-Security-Policy.
Add to ChromeFirefox: coming soon