The simplest solution to stop online ads is to round all advertisers up and exile them somewhere on an uninhabited island. Let’s see how they will sell online casino to each other under such circumstances, right? Although this idea sounds quite entertaining and can be the basis of some reality show no one has the time for it. In this article, we will tell you how ad blocking works to get you closer to the bottom of this mystery.
In few words, ad blocker like AdLock doesn’t allow your browser or other apps that display web content to download ads. This can be done in several ways: AdLock can block communication between a browser and advertising server or block connection with a website from its blacklist. The most important thing is to settle explicit ad-blocking filters so that an application can’t block the whole innocent web source by mistake.
Where do ad-blocking filters come from
In general, it’s easy to recognize ads as most of them are downloaded from similar web servers. The complicated part is to identify which content is commercial and which is not and to settle accurate rules of displaying. Maybe in foreseeable future, we will be able to delegate this menial work to artificial intelligence but so far thousands of developers and just non-indifferent people all over the world work daily on creating the fullest list of ad-blocking filters. Ad-blocking filters give instructions to an application on which content shouldn’t be downloaded.
It’s a global practice for all modern ad blockers, including AdLock to use established and permanently improving filter-list from the web but apart from that, AdLock develops its own filters likewise. It helps to enhance our application and stay one step ahead of the competition. AdLock’s ad blocking process is based on those filters and conducted in 5 steps: 1) DNS filtration, 2) URL filtration, 3) Content filtration, 4) CSS injection, 5) JS injection. Below we will take a close look at each of five steps separately.
- DNS filtration
Before downloading a website your browser or an app sends request to your operating system, and it returns a valid IP address. AdLock mediates between these processes. For example, let’s say AdLock is a telephone operator and an advertising domain server is a dial number. When your browser tries reaching ads server through the operator which is AdLock it tells that this number doesn’t exist. Browser doesn’t reach advertising server, thus it can’t download ads from it.
Despite the simplicity of DNS filtration, it stays imperfect as it ruins the way website is displayed. The thing is websites want to make a profit, and they write adverts into the source code. When we forbid our browser to download commercial content it lefts empty spaces where ads and banners supposed to be. The end result would be similar to artworks of Jorge Pérez Higuera, a Spanish photographer who presented how the world would look without ads. We can’t let you use a website with such a catastrophic design. That’s why we apply number of other filters to return a web page harmonious look.
- URL filtration
DNS filtration can be successfully applied only if ads are downloaded from the third-party domain. If ads are located on website’s domain, we need to analyze the website’s URL. Let’s imagine a website with the URL xxxzzyyy.com, the advertisement on this website will be downloaded from the URL xxxzzyyy.com/ads. URL filter reads a website’s URL and checks whether it requests for the advertisement content and if so, URL filter blocks such request.
- Content filter
Before letting your browser to download a website AdLock’s content filter scans the contents of the website’s HTML source code and cuts of elements that don’t pass ad-blocking filters. This filtering algorithm scans each HTML element (going down from the head of HTML tree to each subelement) according to filtering rules, taking a lot of CPU time and process memory.That why this method of ad filtration is considered to be outdated, as more effective and modern methods exist (see below).
- CSS injection
CSS injection applies after DNS, URL and Content filtration. First, let’s figure out what is CSS. CSS stands for cascading style sheet through which website developers tell our browser how to display each web-page (which colors to use, what font, images, etc.) CSS also specifies the size of spaces reserved for adverts, that’s why when DNS filter blocks ads there are holes left instead of them in the website design. In order to put those holes away, we apply our CSS injection the moment browser downloads a website. CSS injection tells that adverts spread over zero pixels in length and zero pixels in width or as such don’t exist. Next, content elements pull up to take advert places returning web-page clear and laconic exterior.
- JS injection