Adblock Detection Issues

I am working on a basic adblock script detection, and I came up with something similar that it should work. When creating an item on the page with the #adblock_detection_image identifier in Chrome with Adblock Plus running $('#adblock_detection_image').css('display') gives me a value of none , and running $('#adblock_detection_image').css('visibility') gives me the value hidden . When I launch them in a browser without Adblocker, I get inline and visible , as you might expect.

Having discovered this, I went further and tried to develop a solution. However, the problem is that the code that should run when a simple ad unit is detected does not run. The following is a snippet of code.

 function isUsingAdblocker(classOfAd) { if(parseInt($(classOfAd).css('height')) <= 0) { return true; } else { $('body').append('<img id="adblock_detection_image" src="/textlink-ads-banner-advert-service.jpg" style="width: 0; height: 10px; position: relative; top: -1000px; left: -1000px;"/>'); if($('#adblock_detection_image').css('display') != 'inline') { return true; } else if($('#adblock_detection_image').css('visibility') != 'visible') { return true; } else { return false; } } } $(document).ready(function(){ if(isUsingAdblocker('#Ad-One')){ $('#Ad-One').html('<em>Please</em> disable your ad-blocking software to help support this website.<br/><span>(It\ our primary source of income!)'); $('#Ad-One').css('height', '90px'); } }); 
-1
source share
2 answers

perhaps the ad unit removes the element containing the ads, there is "# Ad-one", so when you access the css of this element through jq, you actually accessed the inappropriate element from the html source earlier. it's true?

0
source

Adblock searches for elements containing words such as ad or German "werbung" or other words that are often used for advertising. You must give your elements a different name that does not contain these words. Had the same problem on my first site where I called the div "left_ad".

0
source

All Articles