Frame busting
Frame busting is a JavaScript method that tries to stop a page from showing in a frame. The script checks if the page is the top window. If not, it sends the top window to the URL of the page.
Concept
Also called Frame breaking, Framebuster
Updated
On this page
Example
HTML (legacy script)
<style id="anti-clickjack">body { display: none !important; }</style>
<script>
if (self === top) {
document.getElementById("anti-clickjack").remove();
} else {
top.location = self.location;
}
</script>The page stays hidden until the script finds that it is the top window. OWASP shows this pattern only for old browsers.
Learn more
Sources