Skip to content
Nazmul Nikhil
Menu

Mitigate Clickjacking With XFO or CSP (PageSpeed Insights)

PageSpeed checks that other sites can't load your pages in a hidden frame. Here's the one header that fixes it, on any host.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Mitigate Clickjacking With XFO or CSP (PageSpeed Insights)
Photo: Ari Sha on Unsplash

In short

Clickjacking means a hostile site loads your page in an invisible frame and tricks users into clicking things. Prevent it by telling browsers your pages can't be framed by other sites, with X-Frame-Options or the CSP frame-ancestors directive. Informational in PageSpeed, but this one is quick and low-risk to fix.

Content-Security-Policy: frame-ancestors 'self'
X-Frame-Options: SAMEORIGIN

Apache: Header always set X-Frame-Options "SAMEORIGIN". WordPress: security plugins or the host's header settings. Cloudflare: a Transform Rule adding the header. Shopify, Webflow and Wix: platform-managed.

If you intentionally embed your pages on another domain you own, list that domain in frame-ancestors.

This guide isn't affiliated with or endorsed by Google.

Sources and references

TAGSPageSpeed InsightsMitigate clickjacking with xfo or cspX-frame-optionsFrame-ancestors
Nazmul Nikhil

About the author

Nazmul Nikhil

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.

Need help with this?

Get it fixed with Technical SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Page Speed & Core Web Vitals posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com