Security → How to combat annoying ads in Google Chrome?
Rating: +1
20 Aug 10 at 16:06
This is the second article dedicated to the ad blocking setup in browsers. This time we will discuss the web browser developed by Google. At the time of writing the article described browser extensions worked only in develop-version. Now it is possible to use the latest stable build of Google Chrome.
---------------------------------------------------------------------------------------------------
To continue the topic of annoying advertising blocking I'll tell you about popular web browser developed by Google.
You'll need a developer version of Google Chrome to be able to use add-ons. You can download it by the following a link:
If you look at browser’s properties you will easy notice that the version begins with the number 4:
This is just what we need.
Now install AdBlock+. You can install it from here (Link).
Once the content-filtering extension is installed, the icon of add-on appears in Chromium:
Everything is ready.
Thus, the purpose is the same - to block two advertisements from Habrahabr website:
So, we begin clicking the AdBlock+ icon and selecting "Block element" option (at the same time we are memorizing keyboard shortcuts for this operation):
Then move the mouse cursor on the area you want to block. Chrome will offer different options and highlight them:
When clicking a selected area the browser highlights it in red and displays a window with a filter which will block the area.
I could not select the entire table of the advertising So I had to click on each part of advertising area. At the same time new filters are added to the existed ones separated by commas. There is no user-friendly filter editor, so I have copied the filter’s string and placed it in a text file. When I carefully examined the text, I noticed that each block contains the same div class = "yandex-direct":
An idea came to my head. I click on the same icon and select “Edit rules”:
And replace its contents with the class = "yandex-direct" in square brackets:
It works! The entire table has been disappeared.
It is not so simple about Flash web banner. It's necessary to click on the banner ad:
The banner is activated as a link when clicking it. By the way, in a previous article I focused on the fact that it is no need to click on the links while inspecting by DOM Inspector. I mentioned the DOM Inspector – because of dev builds of Chromium has a similar tool. This tool is called by right-clicking on the area you need to inspect and selecting the "Inspect Element" option in a context menu:
The page's source code is opened. There we can see the part of source code responsible for this area, it is displayed on the page:
It is possible to expand a hierarchy of source code and move the cursor on the strings inside the main unit. You can see that the area containing the banner is highlighted when moving the cursor on the first string:
As can be seen div class = "banner" is responsible for the banner. Without thinking twice I call a rule editor and add the following: