mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
Detect if blocking page is loaded within frame or iframe. If so, hide everything
This commit is contained in:
parent
5374f652dd
commit
480211033d
1 changed files with 19 additions and 1 deletions
|
@ -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='robots' content='noindex,nofollow'/>
|
||||
</head>
|
||||
<body>
|
||||
<body id="body">
|
||||
<header>
|
||||
<h1><a href='/'>Website Blocked</a></h1>
|
||||
</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/pihole/queryads.js"></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();
|
||||
// }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue