articles

Clickjacking protection: when another site embeds your pages

Published 2026-11-22 · 6 min read

How to stop other sites from embedding your pages in a frame, starting from how clickjacking works. This article covers the difference between CSP frame-ancestors and X-Frame-Options, why a meta tag does not work, how V04 shows it in vuln, and how to set it on Cloudflare Pages, Netlify, Vercel, or Next.js. It also includes what we measured on our own site on 22 November 2026.

You have heard the word "clickjacking" and have no idea what to do about it. It shows up in scan results, but it is hard to connect to anything you recognize.

The short answer is one line: stop other sites from embedding your pages. Send Content-Security-Policy: frame-ancestors 'none' and the whole family of framing attacks stops working.

What clickjacking is

Picture a restaurant menu with a clear sheet laid over it. Your finger points at one dish, but a different dish is what gets ordered. That is clickjacking.

Clickjacking is an attack that shows your page inside the attacker's page using an iframe (a part that embeds one page inside another) and lays a transparent button or text on top. The visitor believes they are looking at your site, but the button they press belongs to the attacker.

Nothing about your site looks different. What changes is where the click lands.

Why it concerns you

The target is a visitor who is still signed in. They are made to press a button on your site against their intent.

  • confirming a payment or an order
  • deleting an account, switching a page between public and private
  • changing permissions or an email address
  • following, liking, posting

For example, the attacker's page says "You have won" in large letters. Your site's "Delete" button is laid over it, invisibly. The visitor thinks they pressed the prize button and presses Delete instead.

The more your site has forms, logins, or payments, the more this matters. Even a static profile page can be embedded somewhere else and shown out of context.

One line that refuses embedding

The answer is to refuse embedding in a response header. There are two ways to say it, and either one works.

  • Content-Security-Policy: frame-ancestors 'none'
  • X-Frame-Options: DENY

frame-ancestors is the current form, and X-Frame-Options is for old browsers. Sending both is fine. Modern browsers give frame-ancestors priority.

X-Frame-Options has an ALLOW-FROM form, but almost no current browser supports it, and it cannot list more than one origin. If you need to allow a partner, use frame-ancestors.

`frame-ancestors` does not work in an HTML meta tag. It has to come back as a header.

When you do want to allow embedding

Sometimes a payment or booking widget needs to be embedded on a partner's site. In that case, allow only that origin (the combination of scheme, host, and port).

Content-Security-Policy: frame-ancestors https://partner.example

'self' means "only this site". Add 'self' only if your own pages embed each other. 'none' means "no one may embed this", including yourself.

How it looks in vuln

vuln (a free check that runs on a public URL) shows clickjacking as one row, V04.

  • V04 Clickjacking (area: Headers, priority 3)

V04 looks at the response headers of the top page.

  • X-Frame-Options is present: pass
  • the CSP header has frame-ancestors: pass
  • neither is present: needs work

It only checks presence. It does not tell DENY from SAMEORIGIN, or look at which origins you allow. If you want to judge the strength of the value, read the headers yourself.

A CSP in a meta tag is not used for this check, because frame-ancestors does not work in meta. Even if it is written in the HTML, V04 treats it as absent.

The Evidence and fix column keeps what was observed as key=value lines. With neither header you see request=GET …, header=x-frame-options, and note=absent; csp frame-ancestors absent.

A measurement from our own site

On 22 November 2026 we checked this site's response headers with curl -sSI https://ismyappok.com.

The CSP header contains frame-ancestors 'none'. There is no x-frame-options line. V04 passes because of the CSP setting; we do not send X-Frame-Options.

Here is the main part of the CSP header (the nonce value, some sources, and some directives are omitted).

default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; …; upgrade-insecure-requests

frame-ancestors sits in the same header as the other CSP directives. You add one word inside CSP rather than adding another header.

How to fix it

Where you return the header depends on your hosting or framework. The official steps are here.

On Netlify and Cloudflare Pages, you put a _headers file in the publish directory and list a path such as /* with the headers. On Vercel, you write them under headers in vercel.json. Next.js returns them from headers() in next.config. If you want to add the header at Cloudflare's proxy instead, you can do it with a Transform Rule ("Modify response header").

If you already send a CSP, do not add a new header; add frame-ancestors 'none' inside the existing policy. Deciding on one place to set it saves confusion later.

If you already followed Security headers, explained, this is one more line in the same place. CSP basics covers the bigger picture of the policy.

How it looks in the result screen

"3. Result" in vuln shows a pass-rate summary and the checklist. The table has six columns: ID, Item, Priority, Result, Area, and Evidence and fix.

V04 appears in the Headers area. If nothing blocks embedding, the result is "Needs work". The "Needs work only" filter keeps the row, and its priority of 3 puts it near the top.

What clickjacking protection does not prevent

vuln is not a penetration test. It checks the public face of a site from the outside.

Refusing embedding does not stop attacks that avoid frames: sending people to a fake site, or showing a look-alike screen in another tab. It does not look at scripts injected into the page (XSS) or holes on the server side either.

Finding nothing does not mean the site is safe.

Wrapping up

Clickjacking protection is one line, and it buys a lot, in my view. Even a site with no login or payment would rather not be embedded and shown out of context.

Start with V04 in vuln. If it says "Needs work", add frame-ancestors 'none' to the CSP and go from there.

The fixes are collected on these pages.

When you have changed the settings, run vuln again. You can check display and links before launch with audit (no login) as well.

This article is based on checking our own site's settings. We did not scan anyone else's site for it. The numbers are recommended values and implementation thresholds; the only measurements are the ones with the date and method given in the text.

Check your own site

Enter a URL and see what is missing before launch. Free, and no login required.

Run the free check