Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Iframe blocked by X-Frame-Options or CSP: how to fix it

CNV-354High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

An iframe is a window on your page that shows another page, often a form, calendar or payment widget. Browsers only show that other page if its server agrees to be framed. Two response headers control this: X-Frame-Options (older, values DENY or SAMEORIGIN) and the frame-ancestors part of Content-Security-Policy (newer, lists allowed parent sites).

A second case exists too. Your own site may send a CSP with frame-src or child-src that does not list the embed provider. Then the browser blocks the frame from your side.

Which header blocks which direction
HeaderSet byWhat it controlsTypical console message
X-Frame-Options: DENY or SAMEORIGINSite being framedWhether any or only same-origin pages may frame itRefused to display '...' in a frame because it set 'X-Frame-Options' to 'deny'
CSP frame-ancestorsSite being framedWhich parent origins may frame itRefused to frame '...' because an ancestor violates the following Content Security Policy directive
CSP frame-src / child-srcYour pageWhich origins your page may frameRefused to frame '...' because it violates the following Content Security Policy directive: frame-src

Why it costs you leads or sales

The page looks normal, but the form, calendar or payment box is empty or shows a grey sad-face icon. Visitors cannot submit anything, so every click on your ads or emails to that page is wasted. Nothing errors visibly for you, so it can run for weeks. It often starts after a security plugin, CDN rule or provider change, not after anything you edited on the page.

Where a blocked iframe breaks the funnel
  1. Ad clickVisitor lands on page
  2. Page loadsYour layout renders fine
  3. Iframe requestHeader forbids framing
  4. Form submitNo form to fill in
  5. Lead / conversionNever recorded

The page loads, but the framed form never renders.

A framed page refuses to load

The browser obeys the header and shows an empty frame.

How to check if your site has it

Find out which header is blocking
  1. Open the page in a private window

    Look at the embed area. A blank box, a grey icon or 'refused to connect' points to this issue.

  2. Open the browser console

    Press F12, open the Console tab and reload. Look for 'Refused to display' or 'Refused to frame'. The message names the header and the URL.

  3. Inspect the response headers

    In the Network tab, click the iframe's document request and read Response Headers for x-frame-options and content-security-policy.

  4. Or test from a terminalCustom code

    Run the command below against the iframe's src URL.

Show framing headers of the embedded URLbash
curl -sI https://embed.example.com/form/123 | grep -i -E 'x-frame-options|content-security-policy'

How to fix it

Pick the case that matches your console message. You cannot change another company's headers, so if a third party blocks you, use their supported embed code or a link.

Fix by case
  1. Case A: you own the framed page

    Remove X-Frame-Options (or change DENY to SAMEORIGIN if the parent is on the same origin) and set frame-ancestors to list the parent sites that may embed it.

  2. Case B: a third party owns it

    Use the provider's official embed snippet, which is built to be framed. Check that your domain is on any allowed-domains list in their settings. If framing is not supported, link or open the form in a new tab.

  3. Case C: your own CSP blocks the provider

    Add the provider's origin to frame-src (or child-src) in your Content-Security-Policy.

Case A: allow specific parents to frame your page (nginx)nginx
# remove the old header, then set CSP
add_header Content-Security-Policy "frame-ancestors 'self' https://www.example.com" always;
Case A: Apache equivalenthtaccess
Header unset X-Frame-Options
Header set Content-Security-Policy "frame-ancestors 'self' https://www.example.com"
Where to change it by platform
  1. Check security plugins

    Plugins such as security or hardening tools often add X-Frame-Options. Look for a clickjacking or security headers setting and relax it for the framed page.

  2. Check server or CDN rules

    Review .htaccess, your host's header settings and CDN rules for X-Frame-Options or CSP.

Header before and after

Blocked

  • X-Frame-Options: DENY
  • Console says Refused to display in a frame
  • Visitors see an empty box

Allowed

  • frame-ancestors lists your own domain
  • Form renders inside the page
  • Submissions arrive

How to confirm it's fixed

Confirmation checks
  • Hard reload the page in a private window; the form appears.
  • The console shows no 'Refused to display' or 'Refused to frame' messages.
  • curl shows the headers you intended.
  • Check Safari, Chrome and a phone, not only one browser.
  • Submit a test entry and confirm it reaches your inbox or CRM.

How to prevent it happening again

These blocks usually appear after a change you did not connect to the form: a new security plugin, a CDN or host header rule, a provider policy update, or a stricter site-wide CSP.

Habits that help
  • Keep a list of every embedded provider and its origin.
  • Review frame-src when you add or change an embed.
  • Retest embedded pages after plugin, CDN or hosting changes.
  • Subscribe to provider status or changelog emails.
  • Run the real journey on a schedule, not just once after launch.
How it usually unfolds (example)
  1. Day 0

    A security plugin or CDN rule adds X-Frame-Options: DENY.

  2. Day 0

    Page still loads; embedded form is blank.

  3. Day 10

    Someone notices leads have dropped.

  4. Day 11

    Header is corrected and the form returns.

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor runs your real journey on a schedule, such as landing on the page and filling in the embedded form. If the frame step fails because the frame never loads, the check fails, and the console errors from the page help point to the likely cause. A failure is re-checked from a second region before one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause.

Test traffic is marked (utm_source=funnelguard, fg_test=1) and never bypasses CAPTCHAs or bot protection. The Free plan covers 1 site and 2 journeys with daily checks and no card. Paid plans start at $39/month with a 3-day free trial.

Questions people ask

Why is my iframe showing 'refused to connect'?

The page you are framing sent an X-Frame-Options or CSP frame-ancestors header that does not allow your site to embed it. The browser obeys and shows an empty box. Open the console to see which header and URL is responsible.

How do I fix 'Refused to display in a frame because it set X-Frame-Options to deny'?

If you own the framed page, remove the header or switch to a CSP frame-ancestors list that includes your parent site. If a third party owns it, you cannot change it; use their official embed code or link to the page.

What is the difference between X-Frame-Options and frame-ancestors?

Both say who may frame a page. X-Frame-Options is the older header with only DENY or SAMEORIGIN. frame-ancestors is part of CSP and can list specific allowed sites, and modern browsers prefer it when both are set.

Why does my embedded form work for me but not for visitors?

You may be testing in a browser or logged-in state that differs from visitors, or a CDN or security rule may apply only to some requests. Test in a private window and in other browsers, and compare response headers.

How do I check which header blocks my iframe?

Open the browser console and read the 'Refused to display' message, or check the Network tab response headers for the iframe URL. You can also run curl -sI on the iframe URL and look for x-frame-options and content-security-policy.

Is it safe to allow my site to frame a page?

Yes, if you only list sites you trust in frame-ancestors. Avoid allowing every site, especially on pages with logins or payments, because that opens the door to clickjacking.

Can I embed a page that blocks framing?

Not reliably, and you should not try to bypass the block. Use the provider's supported embed, ask them to allow your domain, or link visitors to the page directly.

Can FunnelGuard tell me when an iframe gets blocked?

Yes. It runs your real journey on a schedule, and a frame step that fails to load triggers a check failure. It re-checks from a second region and then sends one alert with a screenshot and a likely cause.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: frame step fails / console.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.