frame-ancestors
frame-ancestors is a Content-Security-Policy directive that lists the sites that may embed your page in a frame. If a parent frame is not on the list, the browser blocks the load.
CSP directive
Updated
On this page
Example
HTTP response header
Content-Security-Policy: frame-ancestors 'self' https://partner.example
Pages on your own origin and on https://partner.example may frame this page. The browser blocks the frame on all other sites.
How to set it
Send the directive in the Content-Security-Policy header of the page that goes in the frame. If you already send a policy, add the directive to it.
# Your own site and one partner Content-Security-Policy: frame-ancestors 'self' https://partner.example # No site at all Content-Security-Policy: frame-ancestors 'none'
Content-Security-Policy-Report-Only only reports. It does not block the frame, and it does not switch off X-Frame-Options.
Learn more
Sources