<html>
<head>
<script>
function myFunction() {
if (window.top != window.self) {
document.getElementById("demo").innerHTML = "This window is not the topmost window! Am I in a frame?";
} else {
document.getElementById("demo").innerHTML = "This window is the topmost window!";
}
}
</script>
</head>
<body>
<button onclick="myFunction()">Check window</button>
<p id="demo"></p>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_self_top by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:04:10 GMT -->
</html>