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

The page you try to embed sends X-Frame-Options: SAMEORIGIN. The browser shows it only inside frames on the same origin, 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 'sameorigin'.

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 'sameorigin'.

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 “sameorigin“.

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 'SAMEORIGIN'.

On this page

What it means

The site lets only its own pages show it in a frame. Your page is on a different origin, so the browser does not load it. 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: SAMEORIGIN
  1. An origin is the scheme, the host, and the port. https://app.example.com and https://example.com are two origins.

  2. Many sites, frameworks, and security plugins send this header by default to stop clickjacking.

  3. 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. Pick your server. 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.