Refused to display in a frame: X-Frame-Options deny

The page you try to embed sends X-Frame-Options: DENY. The browser does not show it in any frame, not even on its own site, so your iframe stays empty.

  • Chrome
  • Edge
  • Firefox
  • Safari

Updated

Console error · Chrome and Edge, exact text

Refused to display 'https://example.com/' in a frame because it set 'X-Frame-Options' to 'deny'.

Chrome, EdgeExact text

The frame shows a gray page: “example.com refused to connect.”

Refused to display 'https://example.com/' in a frame because it set 'X-Frame-Options' to 'deny'.

FirefoxExact text

The frame shows “Firefox Can’t Open This Page”.

The loading of “https://example.com/” in a frame is denied by “X-Frame-Options“ directive set to “deny“.

SafariExact text

The frame stays blank. There is no message in the page.

Refused to display 'https://example.com/' in a frame because it set 'X-Frame-Options' to 'DENY'.

On this page

What it means

The site does not let any page show it in a frame. This is a choice of the site owner, often to stop clickjacking. Nothing is wrong with your iframe code. Test the URL to see the headers the page sends now.

Why it happens

The server adds this header to each response:

X-Frame-Options: DENY
  1. DENY blocks every frame. SAMEORIGIN blocks only frames on other origins.

  2. Banks, sign-in pages, and admin panels often send it to stop clickjacking.

  3. Chrome writes the value in lower case. Safari writes it as the server sent it. The meaning is the same.

  4. If the page also sends CSP frame-ancestors, browsers follow frame-ancestors and ignore this header.

Check the page

See the headers the page sends now

Fix it if you own the site

Remove X-Frame-Options. Then use CSP frame-ancestors to list each site that may embed the page. Keep the block on pages that must never be framed, such as the sign-in page. The X-Frame-Options guide has the full steps.

location / {
  proxy_hide_header X-Frame-Options;
  add_header Content-Security-Policy "frame-ancestors 'self' https://your-site.com" always;
}
nginx.confReplace your-site.com with the site that embeds this page.

Do not use X-Frame-Options ALLOW-FROM. Modern browsers ignore it. Do not add * to frame-ancestors unless any site may embed the page.

If you do not own the site

You cannot remove the header from your side. No iframe attribute or proxy trick is a safe fix. Use one of these.

  1. Use the official embed URL

    YouTube, Google Maps, Calendly, and others give a special embed link that allows frames.

  2. Link out instead

    Open the page in a new tab with a normal link, or show a preview card that links to it.

  3. Ask the owner

    Ask them to add your site to frame-ancestors. Send them this page.

Sources

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.