HTTPREF
← Back to headers

HTTP Header

X-Frame-Options

Security

Controls whether the page can be embedded inside a frame, iframe, embed, or object.

HTTP header reference, syntax, examples, and developer usage.

What is the X-Frame-Options header?

The X-Frame-Options HTTP header is used to transmit metadata between a client and server as part of HTTP requests or responses.

HTTP headers define how content should be interpreted, cached, authenticated, secured, or processed by browsers and APIs.

Direction

This header may appear in both HTTP requests and responses.

Syntax

X-Frame-Options: DENY | SAMEORIGIN

Example

X-Frame-Options: SAMEORIGIN

Common use cases

  • Clickjacking protection
  • Embedding restrictions
  • Security hardening

Common mistakes

  • Using the header in the wrong request or response context
  • Sending invalid header values
  • Incorrect header syntax
  • Assuming the header automatically changes server behaviour

Related headers