A real trap rig with no script: your browser shows where the click lands. X-Frame-Options and frame-ancestors read by a header model; and a meta, is it…
Why it matters
Clickjacking needs no hole in your code: it is enough that another site may frame your page. One click by a signed-in user can pay, delete or grant something. The fix is not button design but one header that forbids framing.
The key idea
Forbid framing in a header, not in the design
Common mistakes
Thinking a button redesign or an "are you sure?" step stops clickjacking That confirmation is in the framed page too, so it can be covered and clicked as well. Forbid framing with a header: Content-Security-Policy: frame-ancestors 'none' (or 'self').
Only setting X-Frame-Options, not knowing it is an old, rigid headerX-Frame-Options only has DENY and SAMEORIGIN; modern browsers ignore ALLOW-FROM. For a list of sites use frame-ancestors, which also makes X-Frame-Options ignored. Many set both for old browsers.
Setting frame-ancestors through a <meta> tag, yet the browser still renders the iframeframe-ancestors is ignored when it comes through <meta>; it only works from an HTTP response header. Set it on your server or CDN.
Try it in this playground
See the click land in the frame Click the prize button, or let the browser’s hit test show it.
Refuse the next village’s frame Set DENY, SAMEORIGIN or frame-ancestors.
See <meta> frame-ancestors ignored The page with that meta still shows in the frame, in your browser.
See a sandbox switch off the page’s script A frame-buster is only a script; without allow-scripts it does not run.