Javascript to prevent clickjacking
问题 I have this Javascript snippet in my application to prevent clickjacking: <script language="javascript" type="text/javascript"> var style = document.createElement('style'); style.type = "text/css"; style.id = "antiClickjack"; style.innerHTML = "body{display:none !important;}"; document.head.appendChild(style); if (self === top) { var antiClickjack = document.getElementById("antiClickjack"); antiClickjack.parentNode.removeChild(antiClickjack); } else { top.location = self.location; } </script>