-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.html
More file actions
51 lines (48 loc) · 1.02 KB
/
index.html
File metadata and controls
51 lines (48 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE HTML>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Detecting Adblock (inline)</title>
<style type="text/css">
body {
background: #f8f8f8;
font-family: "Segoe UI", Arial, Helvetica, sans-serif;
font-weight: lighter;
color: #333;
padding: 2em;
}
.notblocked {
display: block;
}
.blocked {
display: none;
}
.adblock .notblocked {
display: none;
}
.adblock .blocked {
display: block;
}
</style>
</head>
<body>
<h1>Detecting AdBlock</h1>
<p class="notblocked">AdBlock is disabled.</p>
<p class="blocked">AdBlock is enabled.</p>
<script>
(function(){
var test = document.createElement('div');
test.innerHTML = ' ';
test.className = 'adsbox';
document.body.appendChild(test);
window.setTimeout(function() {
if (test.offsetHeight === 0) {
document.body.classList.add('adblock');
}
test.remove();
}, 100);
})();
</script>
</body>
</html>