# X-Frame-Options

> X-Frame-Options is an HTTP response header that controls whether a page can be framed. Learn DENY vs SAMEORIGIN, why ALLOW-FROM is obsolete and what replaces it.

Canonical: https://scaplet.com/glossary/x-frame-options

Glossary Glossary · Security headers

X-Frame-Options is an HTTP response header that controls whether a page can be framed. Learn DENY vs SAMEORIGIN, why ALLOW-FROM is obsolete and what replaces it.

3 min

read

3

sources

Oct 25, 2026

updated

Scaplet Editorial Team

author

In one line

X-Frame-Options is an HTTP response header that tells a browser whether it may render your page in a frame, iframe, embed or object. MDN says sites use it to avoid clickjacking and some cross-site leaks. The two working values are DENY and SAMEORIGIN. The ALLOW-FROM value is obsolete, and Content-Security-Policy frame-ancestors is the modern replacement.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fx-frame-options%20(%22X-Frame-Options%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fx-frame-options%20(%22X-Frame-Options%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fx-frame-options%20(%22X-Frame-Options%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fx-frame-options%20(%22X-Frame-Options%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 3 minutes.

1. [What X-Frame-Options does 01](#what-x-frame-options-does)
2. [Values and what they mean 02](#values-and-what-they-mean)
3. [X-Frame-Options vs CSP frame-ancestors 03](#x-frame-options-vs-csp-frame-ancestors)
4. [Gotchas 04](#gotchas)
5. [Check it in 2 minutes 05](#check-it-in-2-minutes)

_01_Explained

## What X-Frame-Options does

MDN describes `X-Frame-Options` as an HTTP response header that "can be used to indicate whether a browser should be allowed to render the document in a `<frame>`, `<iframe>`, `<embed>` or `<object>`." The point is to stop other sites from embedding your pages, which MDN says helps avoid clickjacking attacks and some cross-site leaks.

RFC 7034 states the same purpose: it describes a policy sent from the server to the browser about whether the content may be displayed in frames that are part of other web pages. The RFC is Informational, not an Internet Standards Track document. It was written down after browser vendors had already shipped the header.

The header is enforced by the browser that renders your page inside someone else's page. Set it as part of your wider [security headers](/glossary/security-headers).

_02_At a glance

## Values and what they mean

Value

### `DENY`

Effect (per MDN)

The document cannot be loaded in any frame, regardless of origin

Status

Works

Value

### `SAMEORIGIN`

Effect (per MDN)

The document can only be embedded if all ancestor frames have the same origin as the page itself

Status

Works

Value

### `ALLOW-FROM uri`

Effect (per MDN)

Was meant to allow one named origin

Status

Obsolete. Modern browsers ignore the header completely

RFC 7034 words the two working values as rules for the browser. With DENY, a browser "MUST NOT display this content in any frame." With SAMEORIGIN, it "MUST NOT display this content in any frame from a page of different origin than the content itself."

Response headers

```
X-Frame-Options: DENY X-Frame-Options: SAMEORIGIN
```

_03_Check it

## X-Frame-Options vs CSP frame-ancestors

MDN's note on `ALLOW-FROM` points to the replacement: the `Content-Security-Policy` header has a `frame-ancestors` directive "which you should use instead." RFC 7034 says `ALLOW-FROM` supports only one serialized origin, while `frame-ancestors` takes a space-separated list of sources.

Decision rule: if nobody should embed your pages, send DENY or `frame-ancestors 'none'`. If only your own site frames them, use SAMEORIGIN or `frame-ancestors 'self'`. If a named partner must embed them, use `frame-ancestors` only.

Similar policies with frame-ancestors

```
Content-Security-Policy: frame-ancestors 'none' Content-Security-Policy: frame-ancestors 'self'
```

_04_Worth knowing

## Gotchas

### A meta tag does nothing

MDN warns that setting `X-Frame-Options` in a `<meta>` element has no effect. It is only enforced through HTTP headers, so set it on the server, CDN or framework. MDN also says the CSP `frame-ancestors` directive is not supported in a `<meta>` element.

### It is per response

Send it on every HTML response you want protected, not just the homepage.

### Legitimate embeds break

A widget, preview tool or checkout that you iframe from your own domain needs SAMEORIGIN, not DENY.

### ALLOW-FROM silently fails

Browsers ignore the entire header when they see it, so a page that relied on it may be unprotected.

_05_How it works

## Check it in 2 minutes

1. 01

### Open DevTools

Load the page, open the Network tab and select the document request.
2. 02

### Read the response headers

Look for `X-Frame-Options` and for a `Content-Security-Policy` header with `frame-ancestors`.
3. 03

### Test an embed

Put the URL in an iframe on a page from another origin and confirm the browser refuses to render it when you expect it to.

Questions

## Asked a lot.

4 questions people ask next, answered from the sources on this page.

_01_ What does X-Frame-Options do?

It tells the browser whether it may display your page inside a frame, iframe, embed or object on another page. Sites use it to avoid clickjacking.

_02_ Should I use DENY or SAMEORIGIN?

Use DENY if no one should embed the page. Use SAMEORIGIN if only pages from your own origin should frame it.

_03_ Is X-Frame-Options deprecated?

The ALLOW-FROM directive is obsolete and ignored by modern browsers. MDN tells sites to use CSP frame-ancestors instead of it.

_04_ Can I set X-Frame-Options in a meta tag?

No. MDN says a meta element has no effect. It only works as an HTTP response header.

Sources · 3

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- mozilla.org
- rfc-editor.org

1. 01 [MDN: X-Frame-Options header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Frame-Options) developer.mozilla.org · checked 2026-10-25
2. 02 [MDN: Content-Security-Policy frame-ancestors directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors) developer.mozilla.org · checked 2026-10-25
3. 03 [RFC 7034: HTTP Header Field X-Frame-Options](https://www.rfc-editor.org/rfc/rfc7034) rfc-editor.org · checked 2026-10-25

## Keep learning

[All glossary](/glossary)

[Learn Security headers Technical SEO](/glossary/security-headers) [Related Refused to apply style ... because its MIME type Browser errors](/errors/browser/refused-to-apply-style-from-because-its-mime-type) [Read next Content Security Policy Performance](/glossary/content-security-policy) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[x-default](/glossary/x-default)

More in Crawling and indexing
[Subdomain vs subdirectory](/glossary/subdomain-vs-subdirectory) [Trailing slash in URLs](/glossary/trailing-slash) [unavailable_after](/glossary/unavailable-after) [URL fragment](/glossary/url-fragment) [URL Inspection tool](/glossary/url-inspection-tool) [URL parameters](/glossary/url-parameters) [URL structure](/glossary/url-structure) [User agent](/glossary/user-agent) [Video sitemap](/glossary/video-sitemap) [Web crawler](/glossary/web-crawler) [Web scraping](/glossary/web-scraping) [www vs non-www](/glossary/www-vs-non-www) [X-Frame-Options](/glossary/x-frame-options) [X-Robots-Tag](/glossary/x-robots-tag) [XML sitemap](/glossary/xml-sitemap) [301 redirect](/glossary/301-redirect) [302 redirect](/glossary/302-redirect) [410 Gone](/glossary/410-gone) [A record (DNS address record)](/glossary/a-record) [Bing Webmaster Tools](/glossary/bing-webmaster-tools) [Bot management](/glossary/bot-management) [Broken links](/glossary/broken-links) [cache: search operator](/glossary/cache-search-operator) [Canonical HTTP header](/glossary/canonical-http-header)

Terms on this page
[Security headers](/glossary/security-headers)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
