Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ad blocker testscript problem

3 views
Skip to first unread message

Daniel Rafflenbeul

unread,
Oct 27, 2016, 4:07:02 PM10/27/16
to
Hello to all..
I got this ready made script for testing of adblocker.
Itself works fine.

But I need an option to define 2 links in cause of blocked or not.

Under the body opended there are 2 <p> classes.. Thats working.. and there i
need the Links..

If blocked use link 1 and is not blocked Link 2

Can anyone help me ?


The original script is :

<meta name="viewport" content="width=device-width">
<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>

<p class="notblocked">Nicht blocked</p>
<p class="blocked">AdBlock is enabled.</p>


<script>
(function(){
var test = document.createElement('div');
test.innerHTML = '&nbsp;';
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>


0 new messages