0
Hello, I’m trying to implement the ebit banner but I’m having problems with adblocks. In my previous question (ebit banner with 404 error and infinite loop with Adblock on) I was able to implement fuckAdBlock to block ads, but it is not recognizing when Adblock is not activated. Only after several refreshes on the page does it work.
This is my code:
document.addEventListener("DOMContentLoaded", function(){
function adBlockNotDetected() {
console.log('anuncio NAO bloqueado');
}
// Function called if AdBlock is detected
function adBlockDetected() {
//>>esta bloqueando mesmo sem o adBlock estar ativo<<
console.log("Anuncios bloqueados");
}
if(typeof fuckAdBlock !== 'undefined' || typeof FuckAdBlock !== 'undefined') {
adBlockDetected();
} else {
var importFAB = document.createElement('script');
importFAB.onload = function() {
fuckAdBlock.onDetected(adBlockDetected);
fuckAdBlock.onNotDetected(adBlockNotDetected);
}
importFAB.onerror = function() {
adBlockDetected();
}
importFAB.src = 'https://cdnjs.cloudflare.com/ajax/libs/fuckadblock/3.2.1/fuckadblock.min.js';
document.head.appendChild(importFAB);
}
});
</script>
I found a post similar to mine
https://stackoverflow.com/questions/45980660/detect-ad-block-script-runs-properly-only-on-hard-reload
but when I add the fuckAdBlock.check(loop);
he makes a mistake.
document.addEventListener("DOMContentLoaded", function(){ fuckAdBlock.check(loop); });
I don’t know if I wrote it right, because I didn’t want to use jQuery....
It is detecting "enabled" even without Adblock being enabled?
– Sam
yes. It is always falling into the adBlockDetected() function and only after updating the page several times is it that it recognizes that Adblock is not active
– Andrea
which Adblock you are using?
– Sam
https://getadblock.com/ version 3.28.0 , and I’m using Chrome
– Andrea
but I deactivated him to take the test, and yet you’re accusing him of being activated.
– Andrea
I’ll install it to test, it may not detect, will know
– Sam
is this Adblock that use tb
– Sam
and gave no trouble?
– Andrea
I’ll try it again here
– Sam
opens this page and test... open the console to see the messages... works normal
– Sam
Strange Hmmm q, here is still appearing the message of "Blocked Ads" on the console....
– Andrea
I’ll try to clear the Adblock and see what the
– Andrea
on the test? page even with Adblock disabled?
– Sam
for me works normal when active or disable Adblock.
– Sam
good, then you will see it’s my pc kkkk thing. If there appears normal then I think it should not have problem
– Andrea
vc uninstalled? what appeared with it uninstalled?
– Sam
It might be interesting to test in another browser
– Sam
In opera it worked!!!! Then it must be my Christ thing.
– Andrea
vlw for help! and sorry for taking your time ^^'
– Andrea
Imagine! If you need us.
– Sam