-
Notifications
You must be signed in to change notification settings - Fork 435
Does uBlock block ads or just hide them?
uBlock will block any content you instruct it to block, and hide any content you instruct it to hide.
uBlock accepts two types of filters: hosts filters and ABP-compatible filters. Furthermore, there are two kinds of ABP-compatible filters: network filters and cosmetic filters. Cosmetic filters are referred to as element hiding filters in Adblock Plus ("ABP") and Adblock Edge ("ABE").
Short answer: resources blocked: network requests are cancelled before they leave the browser.
uBlock supports the parsing and enforcing of hosts files -- something which ABP does not. All entries in a hosts file are parsed as network filters, i.e. no resource will be fetch from a remote server which appear in a hosts file as no connection will even be attempted.
Blocked network requests are nipped in the bud.
Short answer: resources blocked: network requests are cancelled before they leave the browser.
The purpose of network filters is to prevent a network request to be made to a remote server, so as to prevent downloading a remote resource. uBlock will prevent the network request from even being made. This saves bandwidth and decreases privacy exposure -- as the remote server won't be able to log anything if you do not contact it.
Short answer: resources hidden -- in various ways depending on the class of cosmetic filters.
Cosmetic filters serve to remove DOM elements from a web page. They typically have no value privacy-wise, it is essentially to make web page look better by removing unwanted content, which usually cannot be blocked using network filters. Depending on how the web page is composed, it is possible that they will block some content from being downloaded, but this should not be expected. Just like ABP, uBlock will hide DOM elements on a web page which match cosmetic filters. uBlock uses a different method than other big-name blockers to hide the DOM elements.
Different classes of cosmetic filters are applied differently:
- Specific cosmetic filters: injected before page's root DOM is loaded
- No flickering
- General cosmetic filters: injected after page's root DOM is loaded
- These can be cached
- Since these cosmetic filters are applied after the page loads, DOM elements may be hidden after they are rendered
- Notice the emphasized "may": generally, you won't see this, but the slower computers increase the likelihood
- Cached generic cosmetic filters: injected before page's root DOM is loaded
- No flickering
When a network request is filtered, both uBlock and ABP will collapse the DOM counterpart -- if any -- of a blocked network request. They both work the same way in this scenario (in the absence of a cosmetic filter matching the DOM counterpart of a blocked network request).
In both uBlock and ABP, this occurs after the DOM is loaded, so in both cases, users may be able to visually notice the placeholder collapsing after the page loads.
Yet, uBlock has a significant advantage in such a case: since it does not inject thousands of CSS rules in a page (and frames within that page), this means it makes itself available sooner to handle the task of collapsing the DOM counterpart of blocked network requests. This can be clearly appreciated in the following test page:
- Chromium + uBlock: minimal flickering (sometimes none)
- Chromium + ABP: noticeable flickering
- Firefox + uBlock: no flickering
- Firefox + ABP: no flickering
Another advantage of uBlock here is that these collapsed-DOM-counterpart-of-blocked-network-requests are cached as temporary specific cosmetic filters.