HeaderDial › Guides

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

  1. Open HeaderDial and click + Response header. In the name field type X-Frame-Options, then choose remove in the operation select (set / append / remove).
  2. 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 the frame-ancestors part as the value, for example default-src 'self'.
  3. 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.
  4. In each row's expiry select, pick 15 min, 1 hour, 8 hours or 1 day. The rows then turn themselves off.
  5. 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 sendsHeaderDial ruleChrome 159Firefox 158
nothing (control)noneloadsloads
X-Frame-Options: DENYnoneblockedblocked
X-Frame-Options: SAMEORIGINnoneblockedblocked
X-Frame-Options: SAMEORIGIN, parent on the same originnoneloadsloads
X-Frame-Options: DENY or SAMEORIGINremove X-Frame-Optionsloadsloads
X-Frame-Options: DENYset X-Frame-Options to ALLOWALLloadsloads
Content-Security-Policy: frame-ancestors 'none' (or 'self')noneblockedblocked
frame-ancestors 'none'remove X-Frame-Options onlyblockedblocked
frame-ancestors 'none'remove Content-Security-Policyloadsloads
default-src 'self'; frame-ancestors 'none'set Content-Security-Policy to default-src 'self'loadsloads
both X-Frame-Options: DENY and frame-ancestors 'none'remove X-Frame-Options onlyblockedblocked
bothremove Content-Security-Policy onlyblockedblocked
bothremove bothloadsloads
X-Frame-Options: DENY and a frame-ancestors that lists the parentnoneloadsloads
bothremove both; request types: main frame onlyblockedblocked
bothremove both; request types: main frame, xmlhttprequest, scriptblockedblocked
bothremove both; request types: sub frame onlyloadsloads
bothremove both; Only on Domain = the child's hostloadsloads
bothremove both; Only on Domain = the parent's hostblockedblocked
bothremove both; Only on Page domain = the parent's hostloadsloads

What this shows:

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.

CookieChrome 159Firefox 158
Set on a direct visit with SameSite=Lax, Strict or no attributenot sent in the framenot sent in the frame
Set on a direct visit with SameSite=None; Securesentnot sent
Set by the page while it was in the frame, SameSite=Laxnot storednot stored
Set by the page while it was in the frame, no attributenot storedstored, and sent only inside that frame
Same cookies, parent page on the same site as the child (control)all sentall sent
A HeaderDial + Cookie row set to Send, Only on Domain = the child's hostsent in the framesent 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