New iPad complicates life for HTML5 developers

The new iPad offers no expanded HTML5 support, and iOS 5.1 complicates HTML5 data storage

Apple's new iPad, already a hit with consumers with its high-resolution display, is nonetheless underwhelming some HTML5 developers. The tablet's iOS 5.1 operating system complicates HTML5 data storage, offers no expanded HTML5 support, and the tablet's Web performance is at best only at par with iPad 2.

It's too much to call these "setbacks" and no one is saying Apple is reneging on its aggressive support for the emerging Web standards that will eventually let browser-based apps behave much like native apps. But for some, Apple's decisions are a compromise they could live without.

[ Stay ahead of advances in mobile technology with InfoWorld's Mobile Edge blog and Mobilize newsletter. ]

Ten terrific apps for the new iPad

Sencha, an HTML5 tools vendor, last week posted its "HTML5 Scorecard" for the new iPad and iOS 5.1, calling the results a "mixed bag" for Apple. The vendor's scoring weighs two criteria: completeness –- how much of the various HTML5 elements are present –- and correctness –- how well it supports these elements, says Aditya Bansod, senior director, product management, for the Redwood City, Calif., software company. The blog post also included results of a pair of Web benchmarks testing the new tablet's Web performance.

"It's still the best HTML5 platform on the market," says Bansod. "But we had hoped for a bigger advance than this [in the new iPad]. Instead, we're treading water and even slid back a bit. That's a little disappointing from Apple."

Complicating Web data storage

One change, first introduced early in 2011 with a beta release of iOS 5.1, limits some aspects of HTML5 local data storage. Data that's locally stored using the HTML5 data storage feature, is no longer regarded by the OS as persistent. That presented a problem for developers using that feature with either localStorage or WebSQL as the storage mechanism. Because the OS no longer sees this data as persistent but temporary, "iOS can destroy it at any time, without warning, including during low memory scenarios," Bansod noted in his blog post.

Web developers quickly picked up on the change last January, in various online forums, including the Phonegap forum on Google Groups, which had one developer posting about his troubles as recently as April 1.

The issue affects a subgroup of iOS apps, sometimes called hybrid apps, which use an embedded WebView. "WebViews power HTML5 applications that live inside of native packages, such as PhoneGap or Sencha Touch native packaging," Bansod writes. "They provide an embedded Web browser that is hosted within a native application, permitting the distribution of Web apps to native app stores. WebViews are a feature of all modern mobile operating systems."

Until iOS 5.1, WebView apps could store data locally, and keep it persistent, using HTML5 storage. "Specifically, if your application used LocalStorage or WebSQL, it was considered part of the application's data," says Bansod. If a new app version was released, this data was still present.

That's no longer the case. "This is probably because Apple can't reliably iCloud backup, or iCloud sync from anything that's not stored in the native [iOS] CoreData storage," Bansod speculates. One developer at the Phonegap forum say he was told by "an Apple guy" that the reason for the change was "they did that to save space, because with apps loading a lot of content into a UIWebView (like Twitter), it takes a lot of space [being backed up to Apple's iCloud service]. ... But they completely forgot us, poor phonegap dev[elopers], relying into LocalStorage or WebSQL to store users' data."

"For developers who relied on localStorage or WebSQL as their mechanism to store data in their app, breaking this mechanism is a big deal," Bansod says in his blog post. It's not a showstopper: "There are various workarounds, such as using the PhoneGap-SQLPlugin which uses the underlying SQLite, or writing your own JavaScript bridge to CoreData." For some developers, he says, it means recoding their apps.

In effect, apps without a workaround will "forget" data. Users might lose data too logging into a website repeatedly because their app which used use to store their relevant user data no longer does so, for example.

At least some developers hoped this change was actually a bug and Apple would fix it. On March 7, with the announcement of the new iPad, and iOS 5.1, they discovered that Apple had pushed them into some new territory. "They did it. Apple has released their app with that bug. I already got angry users that lose all their work on my app :-/," posted Sam at the Phonegap forum.

The workarounds have not been simple, as you can see following a discussion thread for one Phonegap plugin, created by Shazron Abdullah at the Apache Software Foundation.

No advance in HTML5 features

Sencha's scorecard also found an absence of any new HTML5 functions in iOS 5.1 and the newest mobile version of Apple's Safari Web browser. "No new features showed up between iOS 5.0 and iOS 5.1," he writes. "iOS still features some of the best HTML5 support on any mobile browser, but this latest incarnation hasn't increased the depth of Mobile Safari's support for the standards."

Safari 6 on the Mac, for example, supports a feature called Cascading Style Sheets (CSS) regions, a way of making it simple to create and change digital magazine layouts. But it's missing from the current Safari on iOS 5.1 devices.

"We were also looking to see if WebGL [a JavaScript API for rendering 3D graphics without a plugin], which is currently only available for Apple iAds, is available in the public browser," Bansod writes. " [a website that assesses your browser's support for emerging Web standards] reports that WebGL is supported in Mobile Safari, but when we used the Khronos demo repository to test, we were unable to get any of the demos to work."

Web performance

To assess, the new iPad's Web performance, Sencha ran set of Web-specific benchmark tests, comparing a new iPad, an iPad 2 (both with iOS 5.1), a Motorola Xoom tablet with Android 3.0, and RIM PlayBook with Tablet OS 1.0. Bansod's team ran the SunSpider test and the V8 Benchmark Suite to measure raw JavaScript processing power.

As is well known, the new iPad uses a version of Apple's dual-core A5 chip, with a new, quadcore graphics processor.

Overall, the new iPad (dubbed "Retina iPad" in Sencha's test results) was somewhat slower in six of the 9 SunSpider tests. In the seven V8 tests, the new iPad general matched the iPad 2, but both lagged the Motorola tablet.

For most Web browsing, Bansod says, users of the new iPad won't see any problems. But there is a noticeable difference between the two iPads when it comes to drawing complex Web pages. For example, the new iPad was visibly loading new tiles at the bottom of one sample page as the page was being scrolled, something that rarely occurs with the iPad 2, according to Bansod.

He speculates that one reason for the performance plateau in the new iPad is that while Apple added the quad-core graphics processor and more memory, it didn't make the memory faster. That would mean, he says, that pumping images and other graphic assets into the GPU is taking more time and bandwidth "than the device can handle in real time."

John Cox covers wireless networking and mobile computing for Network World.
Blog RSS feed:

Read more about anti-malware in Network World's Anti-malware section.

This story, "New iPad complicates life for HTML5 developers" was originally published by Network World.


Copyright © 2012 IDG Communications, Inc.

How to choose a low-code development platform