{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-x-frame-options-e18005b97959","title":"Prevent Clickjacking with X-Frame-Options Header","summary":"Set the X-Frame-Options header or use Content-Security-Policy (CSP) to prevent clickjacking attacks and protect web applications by controlling how pages can be embedded in iframes.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-x-frame-options-e18005b97959","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-x-frame-options-e18005b97959","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-x-frame-options-e18005b97959.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-x-frame-options-e18005b97959\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the server sends an X-Frame-Options header with `DENY` or `SAMEORIGIN` or a Content-Security-Policy header with `frame-ancestors` directive. Both headers can coexist for broader compatibility.","instructions":"---\nname: x-frame-options\ndescription: \"Use when reviewing HTTP response headers for clickjacking protection on any web application with authenticated user actions.\"\nmetadata:\n  category: security\n  priority: high\n  difficulty: beginner\n  estimatedTime: \"5\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/security\/x-frame-options\n---\n\n# Set an X-Frame-Options header\n\nWithout framing protection, an attacker can embed your banking login page in a transparent iframe on a malicious site and trick users into clicking buttons they cannot see \u2014 transferring money, changing settings, or leaking credentials.\n\n## Quick Reference\n\n- Use `X-Frame-Options: DENY` to prevent all framing, or `SAMEORIGIN` to allow framing only from your own domain\n- `ALLOWFROM` is obsolete and unsupported in modern browsers \u2014 use CSP `frame-ancestors` instead\n- The modern equivalent is `Content-Security-Policy: frame-ancestors 'none'` \u2014 prefer CSP for new sites\n- Both headers can coexist: X-Frame-Options for older browsers, frame-ancestors for modern ones\n- Clickjacking attacks trick users into clicking invisible iframe buttons \u2014 DENY eliminates this entirely\n\n## Check\n\nCheck whether the server sends an X-Frame-Options header (DENY or SAMEORIGIN) or a Content-Security-Policy header with frame-ancestors directive to prevent clickjacking.\n\n## Fix\n\nAdd X-Frame-Options: DENY to all responses if the site does not need to be embedded anywhere. If legitimate framing is needed on the same origin, use SAMEORIGIN. For fine-grained control, use CSP frame-ancestors instead.\n\n## Explain\n\nExplain what a clickjacking attack is, how X-Frame-Options and CSP frame-ancestors prevent it, and the difference between DENY and SAMEORIGIN values.\n\n## Code Review\n\nReview server config, headers, forms, and integration points related to Set an X-Frame-Options header. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/security\/x-frame-options\n","use_cases":["Prevent unauthorized embedding of sensitive web pages in iframes on malicious sites.","Secure banking or login pages from being used in clickjacking attacks."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/x-frame-options\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T06:17:21.000000Z","updated_at":"2026-11-24T07:12:47.000000Z","seo_title":"Prevent Clickjacking with X-Frame-Options Header","seo_description":"Learn how to prevent clickjacking attacks by setting the X-Frame-Options header or using CSP for modern browsers. Protect your web application securely.","seo_keywords":["clickjacking prevention","X-Frame-Options header","Content-Security-Policy","web application security"]}}