When convenient
Another website can put your pages inside its own
Your site does not tell browsers to refuse being shown inside another website's page. Adding X-Frame-Options: SAMEORIGIN fixes that for almost every site. The modern equivalent is the Content-Security-Policy frame-ancestors setting, and you can send both.
Another website can put your pages inside its own. Your site does not tell browsers to refuse being shown inside a frame on someone else's page.
Send the technical line below to whoever runs your site. Each of these is a one-line change in the server or hosting settings, and none of them changes how the site looks.
What it means
Any web page can load another page inside a box called a frame. That is how video players and maps get embedded. By default, anyone can put your pages inside a frame on their site.
The X-Frame-Options header tells browsers whether that is allowed. DENY means never. SAMEORIGIN means only your own site may frame your pages. Your site is not sending either, so every site is allowed.
Newer browsers also understand frame-ancestors, a setting inside the Content-Security-Policy header. It does the same job and is more flexible, because it can name specific other sites you trust. When both are present, browsers that understand frame-ancestors follow it.
Why it matters
The attack this prevents is called clickjacking. A scam page loads your real site in an invisible frame and places its own buttons underneath. The visitor thinks they are clicking the scam page, but the click lands on your site: a buy button, a settings change, a delete link.
It matters most on pages where a click does something, such as account pages, checkouts and admin areas. A plain brochure site has less at stake, but the fix is the same one line.
EverThread rates this as a fix to make when convenient. Nothing is broken, and the change does not affect how your own site looks.
How to check your own site
- Open your home page in Chrome, Edge or Firefox. Right-click the page, choose Inspect, and open the Network tab.
- Reload the page. Click the first row in the list, which is the page itself, and look at the Response Headers section.
- Look for
x-frame-options. Also look forcontent-security-policyand check whether it containsframe-ancestors. If neither is there, any site can frame your pages.
How to fix it
Any website
- Decide whether any other website needs to show your pages in a frame. Most small business sites do not. Embedding other sites' content on your pages, such as a YouTube video or a booking widget, is not affected. This header only controls who may embed you.
- If nobody needs to frame your site, use
X-Frame-Options: SAMEORIGIN. It still lets your own site use frames of itself, which some editors and previews rely on.DENYis stricter and fine if you are sure nothing on your own site frames its pages. - If a specific partner site does need to frame you,
X-Frame-Optionscannot express that. AddContent-Security-Policy: frame-ancestors 'self' https://partner.example.com, with their real address. Current browsers follow it overX-Frame-Options. - Do not use
ALLOW-FROM. Modern browsers ignore it. - The header must be sent by the server. Putting it in a
<meta>tag on the page does nothing, and the same is true forframe-ancestors.
WordPress
- Headers are usually best set at the server or CDN, not inside WordPress. Use
SAMEORIGINrather thanDENY, because the WordPress Customizer and many page builders preview your site inside a frame of itself. - Check your host's dashboard for a security headers setting. Names vary by host.
- If your host runs Apache, add the lines from the Apache section below to the
.htaccessfile in your site's main folder. - A plugin is the fallback. Search the plugin directory for "security headers" and pick one that is actively maintained. After any change, open the Customizer and your page builder to make sure the preview still loads.
Shopify, Squarespace, Wix and other hosted builders
- These platforms run the servers, so you usually cannot add custom headers. Some already protect against framing using either header.
- If EverThread reports it missing on a hosted site, there is usually no setting to change. You can ask the platform's support whether their pages can be framed by other sites.
Cloudflare
- Go to Rules and create a response header rule. Depending on your dashboard, this is under Transform Rules, then Modify Response Header, or under Rules, Overview, as a Response Header Transform Rule.
- Apply it to all incoming requests. Choose Set static, enter
X-Frame-Optionsas the header name andSAMEORIGINas the value, then deploy. - Rules only apply to traffic that goes through Cloudflare, shown as an orange cloud in your DNS settings.
Apache (.htaccess)
- Add these lines to the
.htaccessfile in your site's main folder, or to your server's site settings. This needs themod_headersmodule, which most hosts have on. - The second line is the modern equivalent. Sending both covers older and newer browsers. Leave it out if your site already sends a Content-Security-Policy, and add
frame-ancestors 'self'to that policy instead.
<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Content-Security-Policy "frame-ancestors 'self'"
</IfModule>Nginx
- Add these lines inside your site's
serverblock, then reload Nginx. As with Apache, leave out the second line if you already send a Content-Security-Policy and addframe-ancestors 'self'to it instead.
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Content-Security-Policy "frame-ancestors 'self'" always;
What to send your developer
Send X-Frame-Options: SAMEORIGIN (or DENY) and, ideally, Content-Security-Policy: frame-ancestors 'self'. Where both are present, CSP-aware browsers use frame-ancestors and ignore X-Frame-Options. If you need to allow specific embedders, only frame-ancestors can list them; ALLOW-FROM is obsolete. Neither works from a <meta> tag. If the site already sends a CSP, add the directive to it rather than sending a second policy: multiple CSP headers are all enforced, which is safe but harder to maintain. EverThread looks for the X-Frame-Options header by name, so keep it even when frame-ancestors is in place. See MDN on frame-ancestors and OWASP on clickjacking.
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
Common questions
Will this stop me embedding YouTube or Google Maps on my site?
No. This header controls who can put your pages in a frame. It has no effect on frames you place on your own pages.
Should I use DENY or SAMEORIGIN?
SAMEORIGIN is the safer choice for most sites, especially WordPress, because editors and previews often frame the site itself. DENY is fine for sites that never do that.
Is X-Frame-Options outdated?
It has been replaced in the standards by frame-ancestors, but every major browser still honors it and it is simpler to set. Sending both is common and harmless.
A partner site shows our booking page in a frame. What should I do?
Use Content-Security-Policy: frame-ancestors 'self' https://partner.example.com with the partner's real address. X-Frame-Options cannot allow a specific site, but current browsers follow frame-ancestors and ignore X-Frame-Options when both are sent. Test the partner's page after the change.