Privacy and Security

Clickjacking Explained: Checking and Fixing Your Framing Headers

What clickjacking is, why X-Frame-Options ALLOW-FROM no longer protects you, and how to test and set CSP frame-ancestors correctly on any web server.

Saizul Amin
Saizul Amin3 Nov 2026 · 4 min read
Clickjacking Explained: Checking and Fixing Your Framing Headers

Clickjacking is one of those attacks that sounds exotic and turns out to be simple. A malicious page loads your website inside an invisible frame and positions something tempting on top: a play button, a prize, a captcha. When the visitor clicks, the click goes through to your page underneath. If they are signed in to your site, that click might change a setting, confirm a payment, grant an app permission or delete data. The fix is a single HTTP header, but it is surprisingly easy to get wrong.

Two headers, one job

Browsers decide whether a page may be shown inside a frame on another site by reading two response headers.

The older one is X-Frame-Options. It accepts DENY, which blocks all framing, and SAMEORIGIN, which allows only pages from your own origin. A third value, ALLOW-FROM followed by a site address, was meant to allow a single partner. Most browsers never implemented it properly, and today Chrome, Edge, Safari and Firefox all ignore it. A page that relies on ALLOW-FROM can be framed by anyone.

The modern header is Content-Security-Policy with the frame-ancestors directive. It can say none, self, or list specific origins, including wildcard subdomains. When both headers are present, modern browsers follow frame-ancestors and ignore X-Frame-Options. That means a weak frame-ancestors value, such as a lone asterisk, is not rescued by a strict X-Frame-Options sent alongside it.

Common mistakes

The most frequent problem is simply a missing header, often on a few pages such as login or error pages that are served by a different part of the stack. The second is ALLOW-FROM, still found in older configurations. Third is putting frame-ancestors in a meta tag in the HTML; browsers ignore it there, so it has to be an HTTP header. Fourth is sending two X-Frame-Options headers with different values, which some browsers treat as invalid. Finally, a policy that only appears in Content-Security-Policy-Report-Only produces reports but does not block anything.

Checking your own pages

First collect the real headers. On the command line, curl with the silent and head options followed by your page address prints them. In a browser, open developer tools, choose the Network tab, reload, click the main document request and copy the response headers.

Paste them into the Clickjacking Protection Tester. The verdict at the top says whether the page is protected, protected with issues, or not protected, and the findings list explains why in plain terms. If you also paste the HTML head section, the tester spots meta tag attempts that do nothing. It also notices cookies set with SameSite None, which are sent inside third-party frames and make framing protection more important.

Seeing it with your own eyes

Headers can be overridden by a CDN, a proxy or a framework setting you forgot about, so a visual test is reassuring. On the frame test tab, enter the address of a page you own and load it. If you can see and use the page inside the box, other sites could frame it too. If the browser shows a refusal message or an empty area, the protection works.

Turn on the decoy option to understand the attack: the frame becomes partly transparent and a button sits underneath it, just as an attacker would arrange things. It is a useful demonstration for colleagues who doubt that the issue matters.

Writing the right header

On the build tab, choose who may frame the page. Nobody suits most applications. Only my site suits apps that frame their own pages, for example in an admin dashboard. My site and listed partners suits widgets embedded by specific customers.

The tester writes the directive and ready-made configuration for raw HTTP, nginx, Apache, IIS, Express, Netlify or Cloudflare Pages and Vercel. If you already send a Content-Security-Policy, paste it and the tester merges frame-ancestors into it rather than adding a second policy, which browsers would enforce separately and which can block things you did not intend.

Deploy, collect the headers again and paste them in. When the verdict says protected for the origins you expect, apply the same header across the whole site so that new pages are covered automatically.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages