# Using Privoxy to block net nasties and ads in Chrome [Windows]

I love Google Chrome. It is so sleek, so responsive, and so fast. Problem is I’ve been using Firefox with AdBlock forever (well, rounded to the nearest eternity), and when I tried to switch to Chrome all the tracking cookies and ads turned my nice neat intraweb into a garish and frightening place. I finally decided to give Privoxy, a web proxy featuring junk filtering and privacy protections, a try.

## Getting started with Privoxy

2. Set your HTTP proxy in Chrome (which uses the IE/Windows settings) to 127.0.0.1:8118. You can obviously use it from Firefox too if you like.
3. Enjoy!

Wow, that was tough. :) The out of the box configuration seems to do pretty well. You can also delve into the config files and disable certain filters, allow ads for sites that aren’t obnoxious, or switch to only blocking ads on sites you blacklist instead of using Privoxy’s pattern matching. Privoxy is meant to be faster and easier than blocking this stuff in your hosts file as it can use patterns and cache lookups rather than running through each line in your host file every time you need a DNS lookup.

## But I’m already behind a proxy at work! What do I do?

Glad you asked! You can configure Privoxy to forward to your corporate proxy. Go to your install directory (C:\Program Files\Privoxy for me) and edit the config.txt file (er, maybe back it up first :)). Search for the section called “forward” (section 5.1 on my install), uncomment the forward command and add your proxy:

forward / proxy.example.com:8080


This will forward all URLs to the given proxy and port number. Next search for “accept-intercepted-requests”, read the explanation and warnings about the setting, uncomment the command and set it to 1. This will allow any traffic coming back via the corporate proxy to work with Privoxy.

accept-intercepted-requests 1


And with any luck you’re now surfing in Chrome-filled bliss! :)

## But I’m not always behind another proxy! How can I switch settings?

Oh, good question! I couldn’t find any autoproxy.pac style approach for this, so I opted for a fairly basic approach. I created two config files, config.txt.work (with forwarding and accept-intercepted-requests on) and config.txt.nofoward (which is just the default config file for me). I then wrote a little PowerShell script to switch between these (use at your own risk! :)):

$location=$args[0]
$target=$env:ProgramFiles + "\Privoxy\config.txt"
if ($location -eq "work") {$source=$target + ".work" } else {$source=$target + ".noforward" } cp -force "$source" "\$target"


Based on the argument given to the script, this will just copy the required configuration file over Privoxy’s config.txt file. I then setup two shortcuts pointing to this script, one to turn on work mode and the other to turn it off. The shortcut target looks something like this:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit "C:\Users\davesquared\Documents\Applications\PrivoxySwitch\PrivoxySwitch.ps1" work


You don’t need the -noexit option, I just had it in for debugging. Note the command ends with the “work” argument, so the other shortcut should have “noforward” or something similar. Finally I set both shortcuts to run as Administrator so it has permission to copy the files. I’ve got the shortcuts in a location indexed by Launchy, so now I can just activate Launchy, type “switch work”, ok the admin prompt, and I’m in work mode.

## Is it worth it?

Yes, yes it is. Chrome is so nice. And you can do lots of fancy stuff with Privoxy if you delve into it. Have a quick glance through the Privoxy Quickstart and give it a try! :)