Ad blocking

m (Reverted edits by 92.228.43.162 (Talk) to last revision by joerg_rw)
 
(8 intermediate revisions not shown)
Line 18: Line 18:
The hosts file works by blocking access to a large number of known advertising servers, thus preventing the browser from loading content from those servers. Although the hosts file prevents advertising content from being loaded, it does not remove those elements from the page, so you may see warnings about missing pages, images, and scripts. This method can be used in conjunction with the [[#CSS|CSS method]] for element hiding.
The hosts file works by blocking access to a large number of known advertising servers, thus preventing the browser from loading content from those servers. Although the hosts file prevents advertising content from being loaded, it does not remove those elements from the page, so you may see warnings about missing pages, images, and scripts. This method can be used in conjunction with the [[#CSS|CSS method]] for element hiding.
-
The rules for these blocks are put into /etc/hosts. Simply append the contents of [http://www.mvps.org/winhelp2002/hosts.htm one of the example hosts files] to the end of your hosts file. To edit it you need [[root access]]. Be careful to add it to the existing contents instead of overwriting them, as these are necessary for normal operation of the tablet.
+
The rules for these blocks are put into <code>/etc/hosts</code>. Simply append the contents of [http://www.mvps.org/winhelp2002/hosts.htm one of the example hosts files] to the end of your hosts file. To edit it you need [[root access]]. Be careful to add it to the existing contents instead of overwriting them, as these are necessary for normal operation of the tablet.
 +
 
 +
Of particular use in doing this is the program "Advoid", which can be found in one of the repositories.  (Just search the OS2008 downloads and you should find it.)  This program can download the latest hosts file from http://www.mvps.org and update your tablet's hosts file, thus eliminating the need for becoming root and manually editing the hosts file yourself. 
Of the device-based solutions, this is the recommended method, as the performance impact of the other methods is non-trivial.
Of the device-based solutions, this is the recommended method, as the performance impact of the other methods is non-trivial.
 +
Pros:
Pros:
Line 33: Line 36:
The CSS method uses a custom stylesheet that the browser will apply to all pages. This stylesheet has rules for removing advertising elements from the page, it does however '''not''' prevent the advertisements from downloading. Any of the other solutions on this page can be used to prevent downloading advertisements and save bandwidth. The CSS method does provide very advanced options to adjust the rendering of webpages, for example not only for removing ads but also for adjusting the layout to your internet tablet.
The CSS method uses a custom stylesheet that the browser will apply to all pages. This stylesheet has rules for removing advertising elements from the page, it does however '''not''' prevent the advertisements from downloading. Any of the other solutions on this page can be used to prevent downloading advertisements and save bandwidth. The CSS method does provide very advanced options to adjust the rendering of webpages, for example not only for removing ads but also for adjusting the layout to your internet tablet.
-
For an example for such a CSS file, see [http://floppymoose.com Floppymoose.com]. Place this userContent.css file into /home/user/.mozilla/microb/chrome/userContent.css and restart MicroB.
+
For an example for such a CSS file, see [http://floppymoose.com Floppymoose.com]. Place this <code>userContent.css</code> file into <code>/home/user/.mozilla/microb/chrome/userContent.css</code> and restart MicroB.
Pros
Pros
Line 43: Line 46:
=== Quick Toggling ===
=== Quick Toggling ===
-
There is now a Perl script to allow you to quickly toggle on and off the hosts and CSS files. Grab [http://www.singingtree.com/~kyle/blog/archives/00000328.htm this hosts_css_toggler.txt] file and rename it to hosts_css_toggler.pl and make it executable.  Then just run it as root to toggle the Hosts/CSS method of ad-blocking on and off.  You will have to restart the browser for the changes to take effect.  Detailed information and instructions are available on the link provided for the script.
+
There is now a Perl script to allow you to quickly toggle on and off the hosts and CSS files. Grab [http://www.singingtree.com/~kyle/blog/archives/00000328.htm this hosts_css_toggler.txt] file and rename it to <code>hosts_css_toggler.pl</code> and make it executable.  Then just run it as root to toggle the Hosts/CSS method of ad-blocking on and off.  You will have to restart the browser for the changes to take effect.  Detailed information and instructions are available on the link provided for the script.
== Privoxy ==
== Privoxy ==
Line 50: Line 53:
Pros:
Pros:
-
* Lower performance impact that Adblock Plus, but ''may'' be higher than the hosts/CSS combination.
+
* Lower performance impact than Adblock Plus, but ''may'' be higher than the hosts/CSS combination.
* Fairly easy to install.
* Fairly easy to install.
* Can perform on-the-fly content modifications, for example to reformat webpages for the smaller screen.
* Can perform on-the-fly content modifications, for example to reformat webpages for the smaller screen.
Line 58: Line 61:
* Configuration can be difficult.
* Configuration can be difficult.
* May block some applications from network when in use.
* May block some applications from network when in use.
 +
* Not available on the N900 from the Extras repository
To install Privoxy:
To install Privoxy:
Line 72: Line 76:
# Connect to the network again with the connection you just changed.
# Connect to the network again with the connection you just changed.
-
Now this connection uses Privoxy and ads should be blocked. For each saved connection with which you want to use Privoxy you need to edit the proxy settings as shown above. Although you can change the ad-blocking settings by editing the configuration files in /etc/privoxy, the default settings will work for most people. Editing requires root permissions.  
+
Now this connection uses Privoxy and ads should be blocked. For each saved connection with which you want to use Privoxy you need to edit the proxy settings as shown above. Although you can change the ad-blocking settings by editing the configuration files in <code>/etc/privoxy</code>, the default settings will work for most people. Editing requires root permissions.  
-
It is possible that Privoxy stops some applications from connecting to the network as all applications are now forced to go via Privoxy for http and https access. The Wayfinder Map application for example cannot download maps via a connetion with Privoxy. A simple solution is to make another network connection via Settings that does not use Privoxy and switch between them when necessary. Or, if you know the exact domain(s) the application tries to access, you could add the domain to Privoxy's whitelist. To do so edit /etc/privoxy/user.action and put it under the section ' { -block }'.
+
It is possible that Privoxy stops some applications from connecting to the network as all applications are now forced to go via Privoxy for http and https access. The Wayfinder Map application for example cannot download maps via a connetion with Privoxy. A simple solution is to make another network connection via Settings that does not use Privoxy and switch between them when necessary. Or, if you know the exact domain(s) the application tries to access, you could add the domain to Privoxy's whitelist. To do so edit <code>/etc/privoxy/user.action</code> and put it under the section ' { -block }'.
== Adblock Plus ==
== Adblock Plus ==
Line 90: Line 94:
It is available from the Browser Extras repository.
It is available from the Browser Extras repository.
-
You can save time building up your block list by copying your existing ''patterns.ini'' to your tablet here: ''/home/user/.mozilla/microb/adblockplus''. For example, on Windows XP it can be found in C:\Documents and Settings\User\Application Data\Mozilla\Firefox\Profiles\xxxxxxx.default\adblockplus.
+
You can save time building up your block list by copying your existing <code>patterns.ini</code> to your tablet here: <code>/home/user/.mozilla/microb/adblockplus</code>. For example, on Windows XP it can be found in <code>C:\Documents and Settings\User\Application Data\Mozilla\Firefox\Profiles\xxxxxxx.default\adblockplus</code>.
Works great in compliment with Flashblock, also available in Browser Extras.
Works great in compliment with Flashblock, also available in Browser Extras.
-
[[Category:Users]]
 
[[Category:Web]]
[[Category:Web]]
-
[[Category:Beginners]]
+
[[Category:Power users]]

Latest revision as of 12:55, 14 December 2014

Not only does blocking ads remove their annoyance and distraction, it often frees screen real estate for the actual content that you are trying to read, and depending on the technique used it may also reduce bandwidth usage and CPU load. These are important profits on machines with limited processing power and screen size. There are a number of methods for blocking ads, each with their own set of pros and cons. All of these methods can be combined to create the optimal solution.

Contents

[edit] External

Various points in the route from your device to the internet, may provide ad blocking methods. Think about your router/gateway/modem, an external proxy, your internet service provider, and your DNS server. All of these may provide various levels of filtering, though it is still not common.

When available, this is the preferred method, as it has no performance impact on the machine used for browsing.

Pros:

  • No performance impact on browsing device.

Cons:

  • Often less advanced and effective routines.
  • Only available where you can configure elements of your internet route.
  • May be hard to find and configure.
  • Blocking is performed at the connection level, so other network applications may be affected.
  • It affects everybody that uses the same internet connection (this may also be a advantage)

[edit] Hosts file

The hosts file works by blocking access to a large number of known advertising servers, thus preventing the browser from loading content from those servers. Although the hosts file prevents advertising content from being loaded, it does not remove those elements from the page, so you may see warnings about missing pages, images, and scripts. This method can be used in conjunction with the CSS method for element hiding.

The rules for these blocks are put into /etc/hosts. Simply append the contents of one of the example hosts files to the end of your hosts file. To edit it you need root access. Be careful to add it to the existing contents instead of overwriting them, as these are necessary for normal operation of the tablet.

Of particular use in doing this is the program "Advoid", which can be found in one of the repositories. (Just search the OS2008 downloads and you should find it.) This program can download the latest hosts file from http://www.mvps.org and update your tablet's hosts file, thus eliminating the need for becoming root and manually editing the hosts file yourself.

Of the device-based solutions, this is the recommended method, as the performance impact of the other methods is non-trivial.


Pros:

  • Lowest performance impact (effectively zero).

Cons:

  • Less thorough and effective than the other methods.
  • Requires having root access and using XTerm to configure.
  • Time consuming to temporarily disable. (See below for a solution)
  • The 'hosts' file may block network access from some applications as the rules in it are used by all applications accessing the network.

[edit] CSS

The CSS method uses a custom stylesheet that the browser will apply to all pages. This stylesheet has rules for removing advertising elements from the page, it does however not prevent the advertisements from downloading. Any of the other solutions on this page can be used to prevent downloading advertisements and save bandwidth. The CSS method does provide very advanced options to adjust the rendering of webpages, for example not only for removing ads but also for adjusting the layout to your internet tablet.

For an example for such a CSS file, see Floppymoose.com. Place this userContent.css file into /home/user/.mozilla/microb/chrome/userContent.css and restart MicroB.

Pros

  • The most advanced solution for modifying the layout of webpages.

Cons

  • Ads are still downloaded, they are just not displayed. So there is no bandwidth saving.
  • Complex CSS files may have a performance impact.

[edit] Quick Toggling

There is now a Perl script to allow you to quickly toggle on and off the hosts and CSS files. Grab this hosts_css_toggler.txt file and rename it to hosts_css_toggler.pl and make it executable. Then just run it as root to toggle the Hosts/CSS method of ad-blocking on and off. You will have to restart the browser for the changes to take effect. Detailed information and instructions are available on the link provided for the script.

[edit] Privoxy

Main article: Privoxy

Privoxy is an application that can function, among other things, as an ad filtering proxy server. That means that instead of directly connecting to the internet the connection is filtered through Privoxy, which cleanses it of advertising.

Pros:

  • Lower performance impact than Adblock Plus, but may be higher than the hosts/CSS combination.
  • Fairly easy to install.
  • Can perform on-the-fly content modifications, for example to reformat webpages for the smaller screen.

Cons:

  • Small performance impact.
  • Works only for the saved connections where it is configured.
  • Configuration can be difficult.
  • May block some applications from network when in use.
  • Not available on the N900 from the Extras repository

To install Privoxy:

  1. Make sure Extras is enabled and install Privoxy from the Application Manager. After installing you won't see Privoxy in the menu. It just works in the background while it is installed.
  2. Close the network connection on the tablet.
  3. Go to Settings -> Control Panel -> Connectivity ->Connections
  4. Select the connection to use Privoxy with.
  5. Tap 'Edit', 'Next', 'Next', 'Next', 'Advanced'.
  6. At the 'Proxies' tab select 'Use Proxy'.
  7. For 'HTTP proxy' and 'HTTPS proxy' use 127.0.0.1.
  8. For 'Port Number' under 'HTTP proxy' and 'HTTPS proxy' use 8118.
  9. Tap 'OK', 'Finish','Done', 'OK'.
  10. Connect to the network again with the connection you just changed.

Now this connection uses Privoxy and ads should be blocked. For each saved connection with which you want to use Privoxy you need to edit the proxy settings as shown above. Although you can change the ad-blocking settings by editing the configuration files in /etc/privoxy, the default settings will work for most people. Editing requires root permissions.

It is possible that Privoxy stops some applications from connecting to the network as all applications are now forced to go via Privoxy for http and https access. The Wayfinder Map application for example cannot download maps via a connetion with Privoxy. A simple solution is to make another network connection via Settings that does not use Privoxy and switch between them when necessary. Or, if you know the exact domain(s) the application tries to access, you could add the domain to Privoxy's whitelist. To do so edit /etc/privoxy/user.action and put it under the section ' { -block }'.

[edit] Adblock Plus

The popular Mozilla plugin Adblock Plus has been ported to work with MicroB.

Pros:

  • Easy to install.
  • Fairly easy to configure.
  • Has no influence on other applications than the browser.
  • Is more thorough and effective than the hosts/CSS method.

Cons:

  • Significant performance impact that often offsets the benefits of blocking ads.

It is available from the Browser Extras repository.

You can save time building up your block list by copying your existing patterns.ini to your tablet here: /home/user/.mozilla/microb/adblockplus. For example, on Windows XP it can be found in C:\Documents and Settings\User\Application Data\Mozilla\Firefox\Profiles\xxxxxxx.default\adblockplus.

Works great in compliment with Flashblock, also available in Browser Extras.