Old school ad blocking09.03.15 · python
We did it, today marks two full years of [email protected]! If you haven’t already, tell two friends to subscribe.
Ads. No matter how much we loved Mad Men, we do everything we can to skip them. We buy TiVos, we install ad blocker software, and we pay for premium apps instead of their ad-supported counterparts.
But perhaps the web is a special case. I’m still a bit shell shocked from the era of unending popup, pop-under, interstitial, and one-crazy-trick ads. It’s kind of the worst. And don’t get me started on retargeting.
That’s why I’ve been using AdBlock Plus or some version of it for nearly a decade. It’s quite effective in keeping my screen ad free, but in the past few years, it’s become more hinderance than help.
With ABP enabled, Chrome (I know, I know, I should really just switch browsers already) shreds my dual-core CPU and chews through RAM. It’s not a bug either, ADB is just an intensive process.
Fine. I can’t fix ADP, but there alternatives and for the next few weeks I’m going to try an equally effective, but much lower-tech approach: my hosts file.
A hosts file maps hostnames (google.com) to IP addresses (22.214.171.124). And more importantly, it takes precedence over DNS. So, you can map an ad server (ad1.doubleclick.net) to 127.0.0.1 (localhost) and whenever a web site tries to display an ad from that domain, your browser will skip it. That’s some old school adblocking.
When you run
updateHostsFile.py, an interactive prompt walks you through the whole creation process, offers options for customization, replaces your current hosts file, and flushes your DNS cache so you’re ready to go.
FYI, most ad blocking extensions use similar blacklists, but they hide ad elements rather than short-circuiting them to localhost.