Knowledge Base

Frame Protection and X-Frame-Options

Frame protection limits which pages may embed your page. Use it where unwanted framing could mislead a visitor into clicking something sensitive.

Protect the page being embedded

Clickjacking places an interactive page inside another page so a visitor may click it without understanding the action. Login, payment, and account-management pages often need a clear embedding boundary.

Legitimate widgets may need to be framed. A blanket ban can break those uses; choose a policy for the actual page.

Prefer CSP frame-ancestors

Content-Security-Policy: frame-ancestors 'none'

'none' blocks all ancestors; 'self' permits same-origin ancestors. A deliberate allowlist can permit partner origins. Every ancestor in a nested frame chain must satisfy the policy.

Send this directive in a response header. It is not supported in a CSP meta element and has no default-src fallback. It controls who embeds this page; frame-src controls frames this page loads.

X-Frame-Options compatibility

X-Frame-Options: DENY

DENY prevents framing; SAMEORIGIN restricts it to the same origin. ALLOW-FROM is obsolete. Supporting browsers give an enforcing CSP frame-ancestors directive precedence over X-Frame-Options.

When both are sent, keep their intended behavior aligned. Check the final HTML response, including login and error pages; a header on a script response does not protect the HTML page.

Technical sources

Copyright ©2026 MILAN INNOVATIONS LLC. All rights reserved.