How to Remove Ads, Wasted Page Space and Annoying Content

toggle-button

Index

  1. Ads and Wasted Space
  2. The Mechanism
  3. Filter Lists
  4. Effectiveness
  5. Performance
  6. Manual Blocking
  7. Manual Blocking + 1
  8. Holy Trinity of Adblocking
  9. Secure Alternative: RequestPolicy

Ads and Wasted Space

Are you annoyed with ads, banners and other distractions on webpages? Do some of your favorite websites waste screen space on useless content? Adblock Plus can help, and it certainly doesn't come without backup!

Adblock Plus logoABP is just what it says on the tin: an adblocker for both Firefox and Chrome. It's currently one of the most popular add-ons around and most people agree that it does a good job out-of-the-box. It removes content based on filter lists that can either be subscribed to for automatic blocking or created manually/semi-automatically. Doing so speeds up page loading, reduces CPU and RAM usage and, most importantly of all, makes your browsing experience much more enjoyable and smoother.

Of course, blocking ads is just one way to put it to use. It can block literally anything you can write a filter for, including various kinds of page content and even scripts. The latter makes it useful as a less aggressive alternative for NoScript with a block-by-blacklist instead of allow-by-whitelist approach.

However, ABP is not flawless. The default configuration is not the most effective and can — paradoxically — create severe performance issues. You might not notice the latter on a powerful computer, but why would you choose to run sub-optimally if you have the option not to? Laptop users in particular will feel the difference a proper understanding of ABP's mechanism can make.

Note that there are many spin-offs of ABP around: Adblock Edge, Simple Adblock, Adblock Lite, Trueblock Plus, etc. I've tried each one and, to be honest, none have given me any reason to prefer them over the original ABP. If anything, they only created new problems that I won't go into here. My recommendation is to stay away from them.

Bluhell Firewall Logo TeaserWhile ABP is the focus of this article, there are various other adblockers available. I won't talk about those because they focus on a small number of large, mainstream websites only. However, I did come across one particular challenger that immediately struck my fancy... More about that one later!

The Mechanism

ABP actually consists of two parts: the add-on itself and its filter lists. The former is merely a tool that has the ability to remove chunks of content from webpages. The latter are what tell ABP which content to remove, i.e. they're the hand that wields the tool.

When loading a page, ABP reads and processes each filter in the installed filter lists and blocks any matching page content. Some filters describe only a single element, while others are "open-ended" enough to block dozens of elements at once.

Filter Lists

There are 2 kinds of lists: those that you subscribe to and those that you create and maintain manually. Subscription lists are automatically updated and maintained by a community of volunteers with a lead author. These are some of the most popular examples:

  • EasyList is the default that blocks ads in general. There are several specialized derivatives of it;
  • Adversity offers 2 lists: one for ads and general web tracking, and one to get rid of social networks;
  • Fanboy has separate lists for ads, tracking and visual annoyances. Note that Fanboy has moved to EasyList, making these sets a bit redundant.

Effectiveness

Each website or webpage usually requires its own, dedicated filters. Because of this, websites that are not frequented by anyone in a list's community will hardly be cleaned. Small, niche websites are unlikely to be supported by your list while large and well-known websites will be practically ad-free.

Performance

After a few years of using ABP, I started searching for the source of the constant freezes and memory leaks I was having in my otherwise smoothly running Firefox. EasyList and the other popular filter lists sadly turned out to be the culprits. This is what I found:

  1. ABP with subscription lists enabled accounted for 40% of Firefox's internal memory usage, roughly 40MB or about the same as Firefox's own code (not to be confused with the total RAM usage as reported by Task Manager and the like, which is around 200MB for me). Removing the lists entirely (disabling them is not enough!) and leaving only the manual lists reduced this to 400KB, which is pretty much the average of all add-ons;
  2. Firefox reacted much more smoothly and froze much less when loading pages with the lists disabled;
  3. EasyList contains 37,000 filters at the moment and more are added every week. Only 100 or 200 of those filters had ever had any hits, despite months or years of browsing.

The reason popular filter lists make Firefox slow is because of their size. All filters need to be loaded and possibly applied on each page, which is a gargantuan task. I've found traces of a tree structure in which the individual letters of a filter's domain (if any) form its branches. If that's what's used, then ABP can fairly easily skip groups of filters that have no relevance to the current page, but the overall task of navigating the tree and the sheer number of filters to parse is still huge.

I no longer use EasyList or any other subscription lists. But then, how do I block the stuff I don't want? Keep reading to learn more about how to solve that problem!

Manual Blocking

After installing ABP, you'll have 2 new context menu entries: "Adblock Image" and "Adblock Frame". The former obviously serves to block specific images, while the latter blocks specific frames. Wait, what are frames?

A frame is essentially a webpage embedded in another, visually similar to the screenshots embedded in this text. One example can be found right here at Gizmo's: the search box. If you enter something into the search box, you'll get a new page with search results from the site. Doesn't the list of results look familiar though? Indeed, it's a Google page! More specifically, it's a Google frame. Go ahead and try it, but don't forget to click Back to return here!

Adblock Plus new filterWhen you hover the cursor over either an image or frame and click the appropriate option, you'll get a window where you can choose from a set of filters that block what you clicked. Each one has its own level of specificness. The top-most filter blocks only the exact thing you clicked while the bottom one blocks everything coming from the entire website. In-between are options that are slightly more and slightly less specific, one resource directory level and domain level at a time.

If you've read the second part of the Basic Mechanics section in my NoScript article, you'll know exactly what to choose in this window. Otherwise, here's a quick tutorial: things like frames and images are loaded from webservers, where they're stored as files in a folder structure. You'll be blocking specific files, folders or entire webservers with these filters.

In the image to the right, encrypted-tbn0.gstatic.com is the server, gstatic.com is its parent domain (Google's, in this case) and images is the entire relevant folder structure. If you choose the top-most option, you'll probably be blocking every image coming from that particular Google server. Choosing to block gstatic.com will block 99% of everything on every server owned by Google.

To make a long story short, try to block exactly that which seems like the source of the unwanted content, nothing more or less. If you see a folder name that suggests it contains everything you don't want, block that folder. If that's not enough, block the server. If even that doesn't suffice, block the entire network/domain. That is also the following order in which the filters are displayed.

www.example.com/cdn/ads/p.html ads is a suspicious folder name, the rest seems fine. Block only the ads folder.
ads.example.com/cdn/p.html ads.example.com probably hosts nothing but ads. Block the server ads.example.com.
www.adserver.com/cdn/p.html You probably don't want anything from a domain called adserver.com. Block the whole network.

You can also manually modify one of these if they just don't cut it. If you wish to learn how (and I recommend that you do), you can read the excellent tutorial on the official website. It will also show you how to block scripts and other "exotic" page content advanced users may want to be aware of.

Once you've made your choice, the filter will be added to one of ABP's manual lists. You can edit or remove it, or add more by opening the appropriate tab in ABP's Filter Preferences window.

Manual Blocking + 1

Although ABP provides a way to manually select content that needs to be removed, it only works on images and frames. That's hardly sufficient for powerusers. For that purpose, Element Hiding Helper was created!

Element Hiding Helper new filterEHH is a plugin for ABP that allows you to select anything on a webpage and automatically creates a filter for it. Just click "Select Element to Hide" in ABP's menu, hover over what you want to remove, make sure the red selection box is where it should be (there are hotkeys to adjust it) and click when everything looks ok.

In the window that pops up, you can customize the filter you're about to create, though in a much easier way than before. First, select the domain on which the filter should work. Then, simply select the criteria the filter should target. The class, name and id attributes are most useful for this, though you can also select the other ones if left with no choice. Don't worry about messing things up by making the wrong choices: this time, there's a live preview of the filter's effects!

Of course, if you're going to block everything manually, you'll have some work ahead of you.

Holy Trinity of Adblocking

While trying to find a solution that encompasses everything I've written so far, I decided to use simple but abstract computer logic to dictate an answer. I've had some previous run-ins with this method, such as the Secure/Open/Convenient trade-off, which is another variation of the same basic logic. Put simply, trying to simulate human judgment can be done in 2 ways: accurately, which requires a lot of power, or quickly/easily, which won't be accurate.

EasyList and its alternatives try to accurately block everything, making them an example of the former. I think it's wiser to use the latter approach: use a simpe program to get 90% of the work done quickly, then ask the user to complete the final, negligible 10% of the workload.

Bluhell Firewall LogoSo how can this solution be put to use? With Bluhell Firewall! Despite its name, BF is simply a lightweight adblocker. It has no configuration menus or other interfaces and contains a single, very short list of filters based on a contraction of the entire EasyList.

BF will take care of the majority of ads on all websites, but of course it will miss a few. On sites you visit often, you can use ABP+EHH or manual filter writing to take care of the last few eye-sores. It's no more effort than bookmarking a new website and subscribing to its RSS feed. Once it's done, it remains done and you don't need to do it again. On new websites you haven't been to, you'll at least see fewer ads without reduced performance.

Secure Alternative: RequestPolicy

Another way to block ads most of the time is through RequestPolicy. Details about it can be found in the section about it in my NoScript article. Put simply, RequestPolicy blocks all 3rd party content on webpages (except that which you allow through a whitelist or click-to-play), including scripts, images and Flash objects. That means any 3rd party advertisements, be it images or Flash animations, will never load, without the need for specific blacklisting and with a perfectly future-safe approach. The only weakness of it is that content from the site itself is not checked, and a certain portion of ads is indeed hosted locally.

Please rate this article: 

Your rating: None
4.066665
Average: 4.1 (15 votes)
toggle-button

Comments

I know that using easylist without element hiding reduces the memory used in ADP.

Is it possible to reduce the number of rules in the easylist to about 200 rules?

And use a host file to block the rest of the ads.

Nice, thought-provoking article, but the author should have specified that his "Holy Trinity" strategy only works for Firefox users (because the extensions needed for it are Firefox-only, not counting ABP.)

Thanks for the answer...

The approach I was advocating, above, is to use Bluehell in lieu of the "Big Lists", keep ABP and add short lists selectively to ABP like the Fanboy lists mentioned.

I use WOT, I also use EHH, have for a long, also Pop Up Blocker for ABP - when I ran Bluehell last year, I did use EHH to do what you suggested.

I simply don't have the time anymore to develop a manual list.

I'm going to try my approach and see what happens.

Let you know...

Ah, there's the problem: it does not take any time to make those manual lists. You say you use EHH? Then you already are making a manual list. :) That's all there's to it. I only have the EHH list in ABP and that's it. Bluhell does the rest (actually vice versa but you get the point). Fanboy's lists have been merged with EasyList (even the Fanboy homepage just redirects the download to EasyList) and, judging by their popularity, are just as bad for your performance as EasyList due to their presumable size.

Faziri,

Great article.

I like the idea of getting rid of ABP; I have been using Fanboy's Ultimate list for a long time, including the Tracking, Enhanced Tracking and Annoyance lists, which I like.

I do have a question, though...

If you installed Bluehell, kept ABP, removed the main list and just dded the 3 discreet Fanboy lists, above (BTW, I also use the Malware Domains), would this speed up Firefox, maybe not to the extent that it would by removing ADP completely, but would this help performance to some degree while giving me more comfort?

I tried Bluehell (when it was Hellboy), without ABP about a year ago, but I didn't think it blocked things completely or cleanly.

Thanks. :) I didn't say it's a good idea to get rid of ABP though: the large filter lists are the problem, not ABP. If you installed ABP with the Fanboy lists, you wouldn't need Bluhell. The magic trick is to install Bluhell and remove all filter subscriptions, then use Element Hiding Helper to manually make a personal filter for the things Bluhell doesn't filter. That's because Bluhell indeed does not filter everything, therefore you need a tiny little extra to get those few remaining elements. The most efficient way to get that little extra is to do it manually. Instead of Malware Domains, you can also use Firefox's built-in malware domain protection, your antivirus' page blocker or even WOT (or none at all, like me). Just a preference and a suggested alternative, I haven't looked at how efficient Malware Domains is yet. Any workload you can remove will lead to better performance. Shrinking your filter lists will improve performance, but if you remove the best filters you will also get more ads and they will reduce performance again. What you want to do is sacrifice the things that are either using an inexcusably high amount of resources or things that are simply not efficient enough to give you a good advantage. I must say though, I've just started using RequestPolicy (NoScript's little brother) and it's actually helping very well to block ads too (more than Bluhell and ABP/EHH are). I'm in the process of integrating the omni-useful RequestPolicy into my articles now. Sorry if I can't give you a very thorough answer, but these things are impossible to discuss in small posts like this.