If you find advertisements on websites annoying (including the ones here on iPhone Hacks); then on your computer you can always use browser add-ons like Adblock to prevent page elements such as advertisements from being downloaded and displayed.
However, there was no way to block advertisements in iPhone’s Safari browser. Not any more, as James over at James is Bored has figured out a way to block ads even in your iPhone’s Safari browser.
You can checkout the step-by-step guide to block ads on your jailbroken iPhone after the jump.
Before we can start, please note that you need to jailbreak your iPhone.
Please follow the step-by-step guide to block ads on your jailbroken iPhone:
- You need to be able to transfer files to your iPhone, so you can either install OpenSSH application using Cydia or use iPhone software like iPhoneBrowser (for Windows).
- Then go to Settings -> Wi-Fi, click on arrow next to the Wi-Fi server you are currently using on your iPhone and write down the IP address.
- If you are not using iPhone software like iPhoneBrowser to transfer files from your computer to your iPhone and vice versa, then you will need and FTP client with SFTP (secure SSH connection over FTP). Windows users can try FileZilla while Mac users can use Cyderduck.
- Download the replacement host file from this link. (Please note that the host file downloaded from this link will also disable Apple’s kill-switch mechanism to deactivate iPhone apps). Note: If you want to use the Categories App, then please remove the
- Open your FTP client, set it to connect over an SFTP connection, and then put your iPhone’s IP address (the one your had written down in step 2) in the "host" section. The username and password (unless you changed them) are root and alpine, respectively. The connection may take a few minutes at first, and you may be asked to accept a host key; say yes to any prompts. In case the connection fails try again.
- Take a backup of the host file on your iPhone before you override the host file. You will find it in /etc folder at your iPhone’s root directory.
- After taking the backup, replace the host file on your iPhone with the replacement host file you had downloaded in step 4.
- Close your FTP client and restart your iPhone.
After restarting your iPhone, you should start seeing blank spaces or compressed frames instead of advertisements.
If you open the replacement host file using a text editor, you will figure out that the trick behind this iPhone hack similar to the method used by iPhone Expert Zdziarski to block Apple’s kill-switch mechanism to deactivate iPhone apps. You are basically mapping the IP address of most of the ad servers to localhost (127.0.0.1) in the host file.
This hack also seems to block ads in iPhone apps that use any of the ad servers that are mapped to localhost.
You can see the screen shot of the iPhone Hacks website before the Adblock hack below:
And the screen shot of the iPhone Hacks website after the Adblock hack below:
If you observe any issues or want to revert the hack, simply copy the backed up host file back to your iPhone’s /etc folder and restart it.
Hope this makes readers who were complaining about the ads on iPhone Hacks happy. As always, let us know how it goes.
Top iPhone Hacks Categories: