Refused to load: not in the frame-ancestors directive (Safari)

Safari writes this message when the page you embed sends CSP frame-ancestors and your site is not in the list. The frame stays blank. Only the owner of that page can allow your site.

  • Chrome
  • Edge
  • Firefox
  • Safari

Updated

Console error · Safari, exact text

Refused to load https://example.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy.

SafariExact text

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

Refused to load https://example.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy.

Chrome, EdgeExact text

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

Framing 'https://example.com/' violates the following Content Security Policy directive: "frame-ancestors 'self'". The request has been blocked.

FirefoxExact text

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

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 'self'”

On this page

What it means

Safari found a frame-ancestors list in the page you embed, and your site is not on it. Safari does not load the page and leaves the frame blank. Chrome, Edge and Firefox block the same page with other words. Test the URL to see the policy.

Why it happens

The server sends a policy like this one:

Content-Security-Policy: frame-ancestors 'self'
  1. “It” in the message is your page, the parent of the frame. Your origin is not in the list.

  2. With a report-only policy, Safari starts the message with [Report Only] and loads the frame.

  3. Safari shows no text in the frame, so the console is the only place to see the cause.

Check the page

See the headers the page sends now

Fix it if you own the site

Add the origin of each site that embeds the page to frame-ancestors. Pick your server. The frame-ancestors 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.

Write each site as a full origin, such as https://your-site.com. Do not use * unless any site may embed the page.

If you do not own the site

You cannot change the policy of another site. No iframe attribute removes it. 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.