arrow_backAll termssecurity

X-Frame-Options

The X-Frame-Options HTTP response header protects users from clickjacking attacks by preventing a web page from being embedded in an iframe on another site.

Also available: Auf Deutsch

The X-Frame-Options HTTP response header is a crucial security measure designed to protect users from clickjacking attacks. Clickjacking, also known as a UI redressing attack, tricks users into clicking on something different from what they perceive, often by overlaying a malicious transparent iframe over a legitimate web page.

By setting the X-Frame-Options header, a web server can declare whether a browser is allowed to render a page in a <frame>, <iframe>, <embed>, or <object>. This prevents your content from being embedded on other sites, thereby mitigating the risk of clickjacking where an attacker might try to trick users into performing actions on your site without their full knowledge.

There are three primary directives for X-Frame-Options:

  • DENY: The page cannot be displayed in a frame, regardless of the site attempting to do so. This is the most secure option.
  • SAMEORIGIN: The page can only be displayed in a frame on the same origin as the page itself.
  • ALLOW-FROM uri: The page can only be displayed in a frame on the specified origin uri. (Note: This directive is deprecated and not supported by modern browsers; use Content-Security-Policy's frame-ancestors instead for more granular control).

For example, adding X-Frame-Options: DENY to your server's HTTP responses ensures that no other website can embed your application's pages, safeguarding your users from malicious overlays and unintended actions.

Related terms

Audit your site on all of these?

Pantra scans you in 8 seconds. Free, no signup.

Scan my sitearrow_forward