canal.cl

Ignacio Rodríguez de Rementería

How to turn off images in iPhone / Mobile Safari

Versión en castellano: Apagar imágenes en iPhone / Safari móvil.

Ever since I considered getting an iPhone, I had in mind this idea of finding a way to turn off images in the browser.

It is quite surprising how well many web sites are usable with images turned off. Jakob Nielsen would say such a thing is mandatory.

But aside from testing the wit of your favorite site's design teams, turning off images on a mobile device can help you save money by using a small data plan. It also saves time, keeps you from getting distracted by ads and might even help with battery life.

By the time I got my hands on my own iThing, I had done some research and was pretty sure nobody had yet found a way to deactivate images on Safari mobile. Considering that they have the same WebKit code base, I had a hunch the mobile browser might respond to commands from the desktop configuration files.

After jailbreaking the phone I was able to install SSH and tinker around the file system, which is how I found the following file:
 /private/var/mobile/Library/Preferences/com.apple.mobilesafari.plist

I had already seen this, inside the Safari preference files on my Mac:
 <key>WebKitDisplayImagesKey</key>
<true/>

Without giving it a second thought, I added these two lines to com.apple.mobilesafari.plist on the iPhone, changing "true" to "false".

And nothing happened.

Of course. What was I thinking? There was no way it could be so simple, thousands of users must have tried it before, right?

So I forgot about the whole thing until last thursday, the phone was acting up so I restarted it. When it came back, the problems were gone. And to my total surprise, so were web images!

Of course modding files like this to toggle image display is somewhat convoluted, so I did some more research and came across a way of personalizing iPhone's settings app, by editing:
System/Library/PreferenceBundles/MobileSafariSettings.bundle/Safari.plist

I improvised this "Dict", which worked perfectly on mi iPhone, (firmware 2.2):
 <dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<integer>1</integer>
<key>defaults</key>
<string>com.apple.mobilesafari</string>
<key>key</key>
<string>WebKitDisplayImagesKey</string>
<key>label</key>
<string>Display images</string>
</dict>

As you can see in the image, you get a new switch in the Settings app that controls Safari image display.

So if you have jailbreaked your phone and want to give it a shot, please share your results in the comments, and make sure you backup those files first! Oh and please spread the word but don't forget to mention where you found it, thanks.

Update: has been tested and works up to iOS 4.0.1