📜 ⬆️ ⬇️

Making Your Tracking Protection List for IE9

As you probably already know, Internet Explorer 9 has a new privacy feature - Tracking Protection Lists. When you visit a website that contains data provided by a third-party web service (for example, ads, counters, or scripts), some information may be automatically sent to the content provider. In some cases, this may be convenient, for example, the presence of advertising may provide free access to paid content. However, this may ultimately affect confidentiality, since for content providers, it is possible to track user movements between certain sites. When using Tracking Protection, some content may be automatically blocked.

On the day of the release of IE9 RC, the TPL [ link ] page on the IE promo site appeared with a set of lists from partners that can be added to your browser. Unfortunately, the Russian segment was represented in them very sparingly - I found only one site from the .ru zone. Therefore, I decided to create my own list to eliminate this injustice. Fortunately it turned out to be not difficult at all.

It’s worth starting with the fact that Tracking Protection is the direct successor of InPrivate Filtering, which was introduced in the days of IE8, and the concept has not changed much since then. As before, the main task is to ensure the user's privacy as much as possible. Therefore, it is not a full-fledged banner cutter, which is AdBlock. And the removal of the whole "husk" is not a self-determination, and this imposes some restrictions on the functionality.
I will try to explain what it means. Every time you go to the site www.somenews.com you are guided by the fact that the site will show the content that you have been waiting for and that will be finished with it. And you certainly don’t expect that information about your visit (stayed for some time, logged in to such sites, etc.) will go somewhere to the side. We went to read the news, and the files on you were not good. Tracking Protection Lists are designed to protect personal user information from third parties. Therefore, it is believed that if you deliberately went to a certain site, then this site has the right to monitor what is happening on its pages itself (but the scripts uploaded from other sites are not).

List of exceptions for Russian users

I wanted to look at the possibilities that IE provides for filtering content. Information was not too much - a new thing, because it is described so far poorly. Many things had to be studied by examples on the promo-site, and the rest was checked by scientific tyke. In the process formed its list of exceptions. What came out of this you can see on the page where I hung my TPL [ link ]. To make it work, you will need to click on this link from IE9, click on “Add TPL”, then agree to what the browser will offer you and see how the web pages change after activation - there will be less advertising.
To form a list, I had to walk around regularly visited sites and cut out the excess from there. The resulting sample does not pretend to objectivity, but this is not the final version.
')
File format

To create your TPL we need a text file with the extension ".tpl". Formally, the filter list should have such an extension, but IE9 will feel quite comfortable with the usual ".txt".
The first line is the header by which IE determines that it is a TPL. Then comes a list of optional settings that begin with a colon. The truth at the moment I know only one - Expires . Well, then comes the set of filtering rules - one line one rule.
Further an example of the similar file:
msFilterList
: Expires=1
# Tracking Protection List by Eugene Gavrin
#
# Please report any unblocked tracking or problems
# via twitter (https://twitter.com/#!/egavrin)
# or via e-mail (eugene.a.gavrin@hotmail.com).

# Russian ounters
-d counter.rambler.ru
-d tns-counter.ru

The full version is available at the link: [ link ].

Setting auto-renewal period

One of the nice bonuses that TPL acquired, compared to InPrivate Filtering, is auto-update. The default auto update period is 7 days. In the event that the author is not satisfied with this value, he can change this period for a period of 1 to 30 days.
This is done using the Expires option in this way:
# , Expires .
: Expires=5

Now the end user browser will know that once every 5 days you need to go to your site and update the list.

rules

In the TPL, there are two types of rules: universal, which are not tied to a specific domain, and rules that work only for content received from a specific domain.
Each rule begins with the modifier "+" or "-". Minus at the beginning of the rule means that elements that fall under this rule do not need to be displayed. Plus means that these items can be displayed. Plus - this is an exception to the rules, and in the event that there are two identical rules contradicting each other - the controversial content will be displayed.
Next, I will give a few examples:
# Ad20x30.jpg, Ad45x45.jpg, Ad50x10.jpg
- Ad*x*.jpg
# Ad250x600.jpg ,
+ Ad250x600.jpg

# ad-provider.ru
-d ad-provider.ru
# watch.js
+d ad-provider.ru watch.js

#
# :
# ad1.provider.ru
# ad2.provider.ru
# ad3.provider.ru
-d ad*.provider.ru
# ad7.provider.ru
+ ad7.provider.ru

Comments

Any line in the file that begins with the "#" character will be a comment. This line will be ignored, so you can write anything there.
I do not know how to make multi-line comments.

Error handling in lists

IE9 can behave in two different ways when errors occur. In the event that the file does not in any way match the specified format, the browser will start swearing, so you can easily find out about it. In the event that the TPL file comes in the wrong format, the browser will ignore the update.
In the same case, if some rules from the list turn out to be incomprehensible by IE, then it removes this rule from consideration and leaves a small comment like: “I didn’t understand what I’m doing here, so I ignore it”. The end user, if he does not specifically look at the right place, will not know about it.

Debugging

From the user's point of view, everything is fine - there is less advertising, annoying pop-up windows, and so on. But for the developer of filters it is the most difficult stage.
There are two main difficulties with updating the list when debugging, and find out what was filtered.
How to deal with updates of lists? You can, of course, re-subscribe each time you change one rule, but it quickly tires.
Fortunately, we managed to find a place where IE puts downloaded exception lists, here is the way:
%HomePath%\AppData\Local\Microsoft\Internet Explorer\Tracking Protection\

Now I debug exactly the file that lies in this folder, and then update the file on the server.
The debugging process looks like this: saved the file, updated the page in the browser, looked at what has changed. And then the main trouble is revealed - when the browser filters the contents of the page in the address bar, a crossed out blue circle appears, as in the picture below. If you click on it, a menu will pop up, which will offer to disable Tracking Protection on this page:

And how to see what was filtered? Unclear.

Porting AdBlock Rules

Many users are familiar with the AdBlock plugin for FF and Chrome, a simple and effective banner cutter with lists of subscriptions. Most of the rules that are used in AdBlock almost 1 in 1 can be transferred to the TPL.
In this regard, I sluggishly think about the topic of writing a converter from AdBlock subscriptions to TPL -.

Adding a button to the site

It's all very simple, on your website or page you need to insert the following code:
 <a href="javascript:window.external.msAddTrackingProtectionList('rules.txt', 'TPL from HabraUser')">Add HabraUser's TPL</a> 

After that, a button will appear on your website, when clicked, the user will be prompted to add your exclusion list to the browser.

Positive sides


disadvantages


Afterword

It is planned that this list will be updated and edited, so if there are difficulties, they will be glad if you tell me about them :)
I would also be interested to know on which sites the filters do not work or do not work well enough. The more stocks will be found - the more of them will be corrected.

Update:
Many thanks for the feedback you left through the form - I will correct it.

Source: https://habr.com/ru/post/113881/


All Articles