Software
How to Block Ads on Your (Jailbroken) iPhone
Posted by Matt Buchanan at 7:45 AM on October 9, 2008
It's always a kick in the nuts waiting for a page to load in mobile Safari when you know like half of it is for an ad. Luckily, there's a way to block most of them using this method from James Is Bored. It requires a jailbroken iPhone and bit of voodoo, but it's not overly complicated. Once you've got a jailbroken iPhone, you need to install OpenSSH from Cydia. And that's where the work starts.
After your phone restarts, head to Settings>Wi-Fi and hit the arrow next to your home Wi-Fi server. Write down the IP address you see. Then pop back to general settings and set auto-lock to never. On your computer, download this replacement hosts.php file.
Then, using an FTP client like FileZilla or Cyberduck with SFTP (secure SSH connection over FTP), open an SFTP connection with your iPhone's IP address as the host. U/P is root and alpine. The connection will take a bit, and might fail a few times, but say yes to any prompts and keep trying.
At your iPhone's root, navigate to the /etc folder and move the hosts.php file there somewhere on your computer for safe-keeping (don't lose it!). Then replace it with the one you downloaded and restart your iPhone. Now you'll start seeing glorious blank spots or compressed frames wherever ads used to be. It'll nuke ads at most sites serving them through a third-party server. That wasn't so bad was it? The method will work on iPod touches too. Let us know how it goes. [James Is Bored via Lifehacker]

Comments (AU Comments · US Comments)
There are currently no AU comments for this post.
ajlafontaine
Posted 9:04 AM 9/10/08
Done... magnificent!
ajlafontaine
CSX321
Posted 9:03 AM 9/10/08
This same basic technique is pretty effective on any machine and browser, too. I have a big hosts file I use on my desktops, notebooks, and Nokia N800 that blocks most ads. I still see one once in a while, but I've eliminated 95%+ of them. Actually, I think that link may be the same place I originally got the hosts file I started with. I've added to it over time.
CSX321
Sean Robertson
Posted 8:56 AM 9/10/08
@Glare: OK, but I'm not willing to trade for all the things your PSP _doesn't_ do.
Sean Robertson
tridtaei
Posted 8:53 AM 9/10/08
@Glare:
the only problem is you must deal with the pain of owning a PSP
tridtaei
michaelwiggins
Posted 8:53 AM 9/10/08
@Glare: Hail the Jesus phone, you confused bastard!
michaelwiggins
websyndicate
Posted 8:52 AM 9/10/08
@Glare: and this is for the iPhone not the PSP
websyndicate
Glare
Posted 8:48 AM 9/10/08
My PSP already does it.. :/
Glare
cyberwiz01
Posted 10:08 AM 9/10/08
A word to all those who use apps like Quickgold or Categories that are ad supported. Many of them will detect when AdMob is blocked and refuse to run. So either allow AdMob in the host file (delete the line, apparently just commenting it out doesn't work) or don't use the ad-supported apps. I happen to love quickgold and categories so I allowed it. Most ads on websites are still blocked, so not really a big deal to me.
cyberwiz01
UndeadOverlord
Posted 9:59 AM 9/10/08
Hmm for some reason its not working, even on Nytimes.com it doesn't work, I've resprung and rebooted but nothing
UndeadOverlord
supercollider
Posted 9:43 AM 9/10/08
@beekerstudios: I don't think the sponsors are aware of users having ad-blockers. I'm pretty sure they have no affect on a website's ad revenue. Am I mistaken?
supercollider
knome
Posted 9:35 AM 9/10/08
already did it a long time ago using this sites hosts file [www.mvps.org]
for a long time safari just timesout on those sites. Then it starts to learn
knome
Faslane66
Posted 9:35 AM 9/10/08
SWEET!!! Holy CRAP!! finally, saw a few but it worked!
Faslane66
UndeadOverlord
Posted 9:29 AM 9/10/08
Amazing
This is why Gizmodo kicks some serious Ass
UndeadOverlord
beekerstudios
Posted 9:27 AM 9/10/08
Ironically I can use this to block gizmodo ads, further hurting your guys' bottom line. Good job shooting yourselves in the foot!
P.S. Mobile gizmodo still sucks ostrich tits!
beekerstudios
pdditty
Posted 10:23 AM 9/10/08
@beekerstudios: It wont hurt their bottom line. You're still visiting the site which means they get more hits, the stuff advertisers like. Its not like Gizmodo shows figures of how many people visit the site and how many people install this little trick to block their ads.
pdditty
drtaru
Posted 10:36 AM 9/10/08
Unfortunately using a custom hosts file causes some third party jailbroken apps cease to function, like Bossprefs, Categories, Make it mine, etc.
drtaru
WD40
Posted 10:35 AM 9/10/08
you mean there are ads in this site?
WD40
hotmeatinjections
Posted 11:32 AM 9/10/08
@drtaru: Actually I heard that anything using AdMob would suffer from that. Not sure about The Deck, the ads twitterific uses though.
hotmeatinjections
asmodeus
Posted 12:25 PM 9/10/08
Doesn't work for me for some reason. Tested on NYTimes and Wired. Perhaps, there are some prerequisites, that weren't described by James.
asmodeus
matt buchanan
Posted 1:00 PM 9/10/08
@asmodeus: The Times serves ads internally, so it won't work there.
matt buchanan
asmodeus
Posted 2:22 PM 9/10/08
@matt buchanan: OK, I got it - I have to be on 2.x FW. I'm on 1.1.4.
I think Giz should specify this in the post, to eliminate confusion.
asmodeus
asmodeus
Posted 2:21 PM 9/10/08
@matt buchanan: OK, but it won't even block ad at James' page. So it obviously doesn't work.
asmodeus
AllYourBaseAreBelongToUs
Posted 6:38 PM 9/10/08
Great to see Gizmodo endorses ad blockers! I don't feel guilty any more...
AllYourBaseAreBelongToUs
Knirfie
Posted 8:12 PM 9/10/08
Use DiskAid, much easier.
Not sure, but I think DiskAid also works with non-Jailbroken iPhones.
Knirfie