Detect if blocking page is loaded within frame or iframe. If so, hide everything

This commit is contained in:
DL6ER 2016-12-06 14:05:02 +01:00
parent 5374f652dd
commit 480211033d

View file

@ -56,7 +56,7 @@ if($uri == "/")
<meta name='viewport' content='width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=no'/> <meta name='viewport' content='width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=no'/>
<meta name='robots' content='noindex,nofollow'/> <meta name='robots' content='noindex,nofollow'/>
</head> </head>
<body> <body id="body">
<header> <header>
<h1><a href='/'>Website Blocked</a></h1> <h1><a href='/'>Website Blocked</a></h1>
</header> </header>
@ -75,7 +75,25 @@ if($uri == "/")
<script src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>/admin/js/other/jquery.min.js"></script> <script src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>/admin/js/other/jquery.min.js"></script>
<script src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>/admin/js/pihole/queryads.js"></script> <script src="http://<?php echo $_SERVER['SERVER_ADDR']; ?>/admin/js/pihole/queryads.js"></script>
<script> <script>
function inIframe () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
// Try to detect if page is loaded within iframe
if(inIframe())
{
// Within iframe -> hide page
$('#body').hide();
// set white background
document.body.style.backgroundImage = "none";
}
$( "#btnSearch" ).click(); $( "#btnSearch" ).click();
// }
</script> </script>
</body> </body>
</html> </html>