Check your framing settings with a clickjacking test
In a clickjacking attack, another site embeds your page and disguises what the visitor is clicking. Framing restrictions let you decide where your pages may appear.
Choose who can frame your page with X-Frame-Options or frame-ancestors
| Setting | What it permits |
|---|---|
| X-Frame-Options: DENY | No framing, even by another page on your own origin. |
| X-Frame-Options: SAMEORIGIN | Framing only when every ancestor page has the same origin. |
| Content-Security-Policy: frame-ancestors 'none' | No embedding by a parent page. |
| Content-Security-Policy: frame-ancestors 'self' | Embedding by pages on the same origin. Add specific trusted origins if other sites need to embed it. |
Allow intended embeds with frame-ancestors
Identify which pages need to be embedded and which parent sites use them. Send a
frame-ancestorspolicy allowing those parents on those pages; keep other pages more restrictive.For nested frames, every ancestor must match. The directive reference also explains how
frame-srcdiffers: it controls the frames your page loads, not who can frame yours.
Set X-Frame-Options in the response header
Putting X-Frame-Options or frame-ancestors in a meta tag doesn't apply the framing restriction. Set the HTTP response header where your pages are served. The header reference includes server examples.
Frequently asked questions
Does X-Frame-Options replace a Content Security Policy?
No. Framing rules decide who may embed a page. They don't decide which scripts run inside it; a Content Security Policy's script rules do that.
Connect clickjacking protection to your content policy
Website security
Catch leaked API keys and exposed files before someone uses them against you.
Security headers
Learn which response headers guide browser behavior and where to add them.
Content Security Policy
Read your content policy and investigate blocked scripts before tightening it.