Clickjacking and X-Frame-Options, explained in plain English
Clickjacking is a trick where an attacker loads your real website inside an invisible frame on their own page, so a visitor who thinks they are clicking the attacker's page is actually clicking buttons on yours. X-Frame-Options is the response header that tells browsers whether your site is allowed to be framed at all, and it is the simplest way to shut the attack down.
So when people ask what clickjacking and X-Frame-Options are, the short version is: clickjacking is the attack, and X-Frame-Options (along with a modern Content-Security-Policy directive) is the fix. The header has been around for years and takes minutes to add, yet plenty of UK small-business sites still ship without it.
This page walks through how the attack works with a concrete example, then shows the two headers that prevent it and how the free EB Security scan tells you whether yours is set.
What clickjacking actually is
Clickjacking (sometimes called a UI redress attack) layers two pages on top of each other. The attacker builds a page that looks harmless, perhaps a button saying "Click here to claim your prize". Behind that button, loaded in an invisible frame, sits your real site, lined up so one of its own buttons (delete account, confirm payment, follow, one-click purchase) sits exactly under the visitor's cursor.
The visitor sees the decoy and clicks. The browser passes that click through to the framed page underneath, where the visitor is already logged in. The action fires on your site, with the visitor's real session, even though they never knowingly chose to do it.
A concrete example of the attack
Imagine your site has a logged-in page with a "Confirm and pay" button. An attacker creates evil-site.example and embeds your page in a frame set to zero opacity, so it is fully transparent. On top, in plain view, they place a big green "Watch the video" button positioned pixel-for-pixel over your hidden "Confirm and pay".
A visitor arrives at evil-site.example, is still signed in to your service in the same browser, and clicks "Watch the video". The click lands on your invisible button instead. The payment confirms. From the visitor's point of view nothing odd happened, which is exactly what makes the attack effective.
How X-Frame-Options stops it
X-Frame-Options is a response header that tells the browser whether your pages may be displayed inside a frame on another site. If the browser is told not to frame the page, the invisible-overlay trick cannot load, so there is nothing to click through to.
There are two values worth knowing, plus one to avoid:
- DENY: no site at all may frame your pages, not even your own. The strongest setting if you never embed your own pages anywhere.
- SAMEORIGIN: only pages on your own domain may frame your pages. This is the common, safe default for most small-business sites.
- ALLOW-FROM: an older value that is no longer reliably supported. If you need to let specific external sites frame you, use Content-Security-Policy instead.
Free, instant, no account
See your site's security grade in seconds.
Free, instant, and no account needed to see your grade.
Scan my site freePlain-English A to E grade in about 10 seconds. No account needed to see it.
The modern way: CSP frame-ancestors
Content-Security-Policy has a directive called frame-ancestors that does the same job as X-Frame-Options, with finer control. It lets you list exactly which origins are allowed to frame your pages, rather than the all-or-same-origin choice X-Frame-Options gives you.
For reference, frame-ancestors 'none' is equivalent to DENY, and frame-ancestors 'self' is equivalent to SAMEORIGIN. Modern browsers prefer frame-ancestors when both are present, so the usual advice is to set both: X-Frame-Options for older browsers and a CSP frame-ancestors directive for current ones.
How the EB Security scan checks this
Our free scan is an external, passive check: it reads the response headers your site already serves and reports whether clickjacking protection is present. If X-Frame-Options or a Content-Security-Policy frame-ancestors directive is missing, the finding is flagged with a plain-English explanation and the fix.
Be clear on the limits. A missing header here is a hardening gap, so on its own it nudges your grade rather than sinking it; critical problems like a broken certificate or an exposed secret are what hard-cap a grade. The scan reads the header on the page it requests and does not log in or build a real framing attack, so treat the result as a fast first signal and confirm the header on your sensitive logged-in pages too.
Clickjacking hides your real site in an invisible frame so visitors click things they never meant to. Set X-Frame-Options (SAMEORIGIN or DENY) and a CSP frame-ancestors directive to shut it down, and use the free EB scan to confirm the header is actually being sent.