X-Frame-Options: Protect Your Site from Clickjacking
Discover how simple HTTP header changes can prevent others from embedding your site in an iframe and protect against clickjacking attacks.

What is Clickjacking?
Clickjacking is a type of malicious attack where an attacker uses an invisible or transparent iframe to trick a user into clicking on a link or button on another website. This can be used to steal sensitive information, perform unauthorized actions, or compromise accounts.
How X-Frame-Options Works
The `X-Frame-Options` HTTP response header allows you to control whether your website can be embedded in an `
Available Directives
1. **DENY**: Prevents any site from framing your content, including your own domain. 2. **SAMEORIGIN**: Allows only sites on the same origin (protocol, domain, and port) to frame your content. 3. **ALLOW-FROM (Deprecated)**: Allows only specific domains to frame your content. This directive is widely deprecated and should be avoided in favor of Content Security Policy's `frame-ancestors`.
Implementing the Header
You can easily implement the `X-Frame-Options` header on your web server or CDN. For example, in Nginx, you would add:
add_header X-Frame-Options "SAMEORIGIN";
In Apache, you would add:
Header always set X-Frame-Options "SAMEORIGIN"
Auditing Your Protection
Use **ViewPageSource** to audit your HTTP headers and ensure that the `X-Frame-Options` header is correctly configured to protect your site against clickjacking.
Conclusion
Preventing clickjacking is an essential part of your website's security strategy. By correctly implementing the `X-Frame-Options` header, you can protect your users and ensure that your content is only viewed on your trusted domain.
Ready to optimize your site?
Use our professional tools to analyze your source code and technical SEO health in seconds.
Start for Free →