Simon Willison’s Weblog

Subscribe

Does Facebook’s iPhone app use a proprietary web rendering engine instead of UIWebView?

22nd January 2012

My answer to Does Facebook’s iPhone app use a proprietary web rendering engine instead of UIWebView? on Quora

I did my first bit of iPhone development recently (building the first version of the Lanyrd iPhone app) and there was one thing that came as a huge surprise: the principle reason that people think native apps are “snappier” or “more responsive” than native ones has nothing to do with the rendering performance of a webview vs a native view (especially on the iPhone 4S which is extremely fast).

The reason webviews feel less responsive is that there is an artificial 300ms delay on link clicks (and in fact any click event) in a webview!

As I understand it, this delay exists so that the webview can tell the difference between a tap, a double tap and a tap-and-hold gesture—but the result is a noticeably different (worse) feel than a native UI component.

Thankfully, it’s possible to work around this limitation by listening to touchdown events using JavaScript instead of regular clicks. Any time you see an app with surprisingly responsive taps inside a webview (like the Facebook app, and I think the Quora app too) the app is probably using a JavaScript workaround. Here’s one pretty good explanation of the technique written by a Google engineer: http://code.google.com/mobile/ar...

For the Lanyrd app we use a combination of native views for table-style listings and web views for formatted content, with a JS workaround for clicks within the webviews. It works pretty well, but I was very frustrated at the lengths we had to go to just to avoid that nasty artificial 300ms delay!