Skip to content

What does 'Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'' mean?

Short answer

The framed page tells browsers not to be embedded by other sites, via X-Frame-Options or CSP frame-ancestors. That's clickjacking protection working. If you own both sites, allow your exact parent origin with frame-ancestors. If you don't own the framed site, you can't override it, so link to it instead.

Last updated 2026-11-25 · Reviewed by ProofForge

The exact error

text
Refused to display 'https://app.example.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Refused to frame 'https://app.example.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".

Why it happens

  • The site sends X-Frame-Options: DENY or SAMEORIGIN.
  • The site's CSP has frame-ancestors 'none' or 'self'.
  • Third-party login and payment pages always refuse framing.

How to fix it

  1. On the site being framed, replace X-Frame-Options with an explicit allowlist:
  2. Keep 'none' on pages that should never be framed (login, settings, checkout).
http
Content-Security-Policy: frame-ancestors 'self' https://dashboard.example.com

Check it's fixed

The embed works on your allowed origin, and the page still refuses to load inside an iframe on any other site.

Check your live app

A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.

Read-only. No writes or row contents.

FAQ

Can I remove X-Frame-Options to make it work?

Only if you replace it with frame-ancestors listing specific origins. Removing both lets any site overlay your app and trick users into clicks.

Which wins if both are set?

Browsers that support frame-ancestors use it and ignore X-Frame-Options.

Can frame-ancestors go in a meta tag?

No, it's ignored in <meta>. It must be an HTTP response header.

Sources

Related

Read as Markdown · Scan methodology