Understanding How Adblocker Works

How would a chrome plugin differentiate between ads and other content on a website? Here's the different ways it works.

Detecting Scripts

Simple, it will block any script file which is named as ads.js from loading into the browser. And all that logic you wrote, well it's not reaching the browser

<!-- This will be detected -->
<script src="ads.js"></script>

 

Detecting HTML Elements

Any element with a class adBanner also gets collapsed or removed.  It's easy to detect, you can check the height or width of a wrapper div for your adBanner, and it should be 0.

<!-- This will be detected -->
<div class="adBanner"></div>

 

BlackListed By Individual List Maintainers

There are many indepent developers who maintain lists of spammy websites for these adblockers, if your domain lands in one of these, then you can contact the list maintainer to remove it.

 

Next, let's code!

Discussion

Be the first one to comment!