I tried to put the following code in HTML but it is not helping me avoid me the clickjacking:
meta http-equiv="X-Frame-Options" content="DENY"
I wrote the following code in Javascipt:
if (self == top) {
document.documentElement.style.display = 'block';
} else {
top.location.replace(document.location);
}
This solves my problem, but I don't want to redirect it a new URL, but instead, I want to show the clickjacking URL with an empty iFrame.
This is the HTML code I am using to test clickjacking:
iframe {
width: 800px;
height: 1000px;
position: absolute;
top: 0; left: 0;
filter: alpha(opacity=50);
opacity: 0.5;
}
<iframe src="URL">
I want to display only an empty frame when I run the above code.