Utility Nav Menu

HTML5 and Native, Apps

"Write once, run anywhere"... coined by Sun Microsystems in the late nineties has been a siren song to developers for over a decade. Today the pull of this goal can be felt the strongest in the mobile application space with the desire to write HTML5 web apps instead of native iOS or Android code. Many developers and analysts love to cast this in the competitive terms of "HTML5 vs. Native"... two enter, one must fall!

This needn't be a debate! Web technologies and native code can coexist very happily in a single application and we're better off thinking of it on a spectrum. Both iOS and Android have done an excellent job in giving the developer the capability of blending web content and logic into native views. As an iOS developer, I can write a rich, fast, native UI but implement that one nasty dynamic layout problem in HTML, CSS and Javascript rendered by WebKit. Furthermore, when I port the code to Android I don't have to write the complex layout logic twice.

There are clear limitations to writing a pure HTML5 mobile web application with no native code. Instead of rehashing them here, I highly recommended reading the ongoing discussion on Google+. Discussed are tools and strategies to alleviate some of the limitations, but the consensus is that a pure mobile web application is not a viable strategy in many cases. Instead, people are starting to discuss web and native code coexisting in a single application. Indeed, there have been high profile applications that follow this path since the beginning of the mobile marketplace.

The Facebook app for the iPhone is an illuminating example of drawing the line between HTML & native in a very sensible way. If you have it (and if you have an iPhone, you probably do), fire it up right now and poke around it a bit. For the most part it feels like a native app and it certainly has all the benefits of one - a fast UI that is rich and expressive, push notifications, location awareness, photo & video capturing. However, if you have an experienced eye for these sort of things you'll notice that major parts of it (the news feed, your wall, the events page) are actually HTML content. Facebook has cleverly embedded lots of little areas of web content within a native application. They benefit by cherry picking the best features of HTML - dynamic layout of content and richly mixed imagery and text.

For further evidence of the viability of a hybrid approach, look no further than Apple themselves. If HTML5 was truly going to "defeat" or "kill" native apps you can bet that Apple, as defensive a company as they are, wouldn't have any part in enabling a competitive technology (such as say.. Flash). Quite the opposite, Apple has massively enabled the transition of the open web into the mobile world. They've even embraced hybrid native & HTML applications in their own apps - starting with their premier mobile app - the App Store itself. The app description content and list of available updates is implemented as HTML streamed down to the device - and anyone who was paying close attention right after the iCloud announcement suddenly saw the new Purchased button & interface without any software update required.

"Write once, run anywhere" will always remain an enticing goal, now and in future generations of software platforms. But it will always be subject to the inherent limitation of writing code for a least common denominator. Supporting the native features of a certain platform in a cross-platform way will always lag until the native feature has become a commodity supported by ALL platforms. Thankful for all of us, the current generation of software platforms allow us to almost seamlessly blend cross platform content & code with bleeding edge native features as much as we see fit.