if (window.top !== window.self) {
alert("IFrame is detected!");
window.top.location = window.self.location
}X-Frame-Options: DENY
X-Frame-Options: SAMEORIGIN
X-Frame-Options: ALLOW-FROM https://example.com/
| Value | Description |
|---|---|
| DENY | The page cannot be displayed in a frame, regardless of the site attempting to do so. |
| 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. |
For SAMEORIGIN
Header always append X-Frame-Options SAMEORIGIN
For DENY
Header set X-Frame-Options DENY
add_header X-Frame-Options SAMEORIGIN;
<system.webServer>
...
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="SAMEORIGIN" />
</customHeaders>
</httpProtocol>
...
</system.webServer>rspadd X-Frame-Options:\ SAMEORIGIN