Live data from Hacker News

Mobile development with HTML5

engineyard.com

21–30 of 39 posts

Re: Mobile development with HTML5

#21
I use the HTML5 app cache. I have tens of millions of users on this in-production product. I only really feel safe doing this because I have a custom web browser, and as I only target jailbroken devices I can hack at WebKit a little to make this work.

When I started using it, it seemed awesome. Then I played with it a little, and it started failing. Given that I have friends who actually give talks at conferences on the HTML5 application cache and how cool it was, this didn't make any sense: I believed I must be doing it wrong.

Then, one day, I decided to read the source code for WebKit's implementation of the HTML5 application cache, and found it to have tons of race conditions that would lead to whole-browser crash conditions (which I was even experiencing in my app). I even found a bug on the bug tracker with my most-occurred bug on it.

https://bugs.webkit.org/show_bug.cgi?id=43506

Only, that bug had been filed only months before, and this feature of WebKit had been "in production", with these bugs, for a couple years. My only guess is that no one really uses this feature very often.

Reading into the bug tracker some (to find more bugs), staring at the commit messages for the previous year, and even reading some of the posts on the mailing list, I found choice quotes from the people maintaining it that explained that no one knew how this code works, and that the one guy who did forgot.

In iOS 4.3 (I believe it was only 4.3, not 4.2, but I'd sort of believe 4.2, /maybe/ even 4.1), the crash bugs have been "fixed" (or I'd have given them to comex to maybe build another jailbreakme.com), but the race conditions remain: the code doesn't actually /work/, it just sort of doesn't fail.

Specifically, the issue is that the application cache loader for a page is tied to a specific frame: the one that started loading the cache. If that frame is freed, such as by the simple act of the user hitting the reload button, while the download is occurring, the entire thing gets wedged, and you can no longer get any parts of your page cached, nor can you recover or fix the process without the user totally closing the web browser and reopening it.

In practice, this actually happens constantly: if the user has a reasonably slow connection, and things are taking a while in the background to cache, they will hit reload. This deletes the old frame, but associates a new frame with the same cache builder. When the current download stops, the frame it was using is gone, and it ends up in this horrible wedge state.

Ok, I no longer even remember why I'm bothering to type this here (does anyone care? does anyone actually intend to try to use this feature? ;P), but I also no longer seem to have anything more to say, so I'm going to click "add comment" ;P.

Re: Mobile development with HTML5

#22

Earlier quoted context omitted.

I'm not talking about download times, I'm talking about execution time. Size affects execution performance, whether it is cached or not. This is because almost invariably the larger the JS is, the more code you're likely executing.

This is exactly why I run my text editors in Windows 95 still. There is far less code than current versions of windows and I find a huge performance hit when using these newer versions.

HN isn't the place for novelty accounts

Re: Mobile development with HTML5

#23
post #19

I recently visited a site from HN on my phone, but its text was a bit too small for me to read, so I tried zooming in. To my surprise, it didn't zoom at all! From this article, the website must have set user-scalable=no. I don't really see the point of this option. The website can (presumably) scale to many different devices already, surely it can then scale with zooming as well. I'd think you could use percentages t…

user-scalable=yes breaks presentation on iPad when switching orientation http://adactio.com/journal/4470/

As annoying as it is, it makes sense that some web developers would choose this option. Although, limiting the experience for everyone just because one mobile browser has a bug? I'm pretty sure something similar happened with a certain browser called ie6. From the link you gave, it looks like you can just detect an iPad and disable zooming in that case (although, that requires some javascript or server side programming).

So, which version of iOS do they plan on fixing this (or did fix this)? But then, that doesn't factor the people who don't know about OS updates and never sync.

Re: Mobile development with HTML5

#24
post #2

Nice overview. One note of caution: Rendering on the client side using jQuery Templates as the author suggests is great for small amounts of content, but even a list with 40 items will nearly freeze the UI while its rendered. I've experienced this on both iPhone and Android. Also, using a cache manifest will cache your AJAX/JSONP calls. Either explicitly list these URLs in the network section of your manifest or add…

Was this a straight HTML list or were you using a jQueryMobile listview to pretty it up? When we've used templates to render a list (using either underscore or ejs) it was taking 10-20ms to generate the initial HTML but around 10-15x as long to call listview on it.

Re: Mobile development with HTML5

#25

Real-world web-app development is much different than the ideal of HTML5. jQuery? Just including that puts your mobile web-app at 86KB of JavaScript and you haven't even written a single line of your app's code. Rendering on the client-side with jQuery templates is not anywhere near practical for the majority of web-enabled phones – if not all of them except the iPhone. More than 100-150KB of JS and most phones will…

Don't use jQuery or any framework

http://zeptojs.com is worth considering for some cases (~5k micro-library for mobile WebKit browsers)

Re: Mobile development with HTML5

#26

Real-world web-app development is much different than the ideal of HTML5. jQuery? Just including that puts your mobile web-app at 86KB of JavaScript and you haven't even written a single line of your app's code. Rendering on the client-side with jQuery templates is not anywhere near practical for the majority of web-enabled phones – if not all of them except the iPhone. More than 100-150KB of JS and most phones will…

> don't use CSS3 Be careful with your advice. Using CSS3 3D transforms gives you hardware acceleration.

Only on iOS AFAIK, coming in later Android (3.0?)

Re: Mobile development with HTML5

#27
"user-scalable=no".

Is this really the way forward? Why the assumption that the only reason I might zoom in is 'accidental'?

Also I am uneasy about populating all content via JSON but I can't put my finger on the precise technical reasons (but then neither could Gawker wrt desktop browsers so they went ahead with it anyway)

Re: Mobile development with HTML5

#28

Real-world web-app development is much different than the ideal of HTML5. jQuery? Just including that puts your mobile web-app at 86KB of JavaScript and you haven't even written a single line of your app's code. Rendering on the client-side with jQuery templates is not anywhere near practical for the majority of web-enabled phones – if not all of them except the iPhone. More than 100-150KB of JS and most phones will…

Ok, I'm getting ready to write an HTML5 app for cross-platform use.

I grok what you're selling, but looking at JQuery, and especially Sencha Touch, I'm asking myself: how the heck could I make a native-looking app in plain JS without having to dive deep and beating the hell out of myself with all this crap that's already been solved?

Are you saying that the extra UI snazzle just isn't worth it? Or to buck up and start trying to replicate huge pieces of frameworks on my own?

Re: Mobile development with HTML5

#29
post #21

I use the HTML5 app cache. I have tens of millions of users on this in-production product. I only really feel safe doing this because I have a custom web browser, and as I only target jailbroken devices I can hack at WebKit a little to make this work. When I started using it, it seemed awesome. Then I played with it a little, and it started failing. Given that I have friends who actually give talks at conferences on…

> does anyone care? does anyone actually intend to try to use this feature? ;P

Yes, that's a very interesting (if disheartening) exposé on the risks of trying to use the application cache.

Re: Mobile development with HTML5

#30
post #21

I use the HTML5 app cache. I have tens of millions of users on this in-production product. I only really feel safe doing this because I have a custom web browser, and as I only target jailbroken devices I can hack at WebKit a little to make this work. When I started using it, it seemed awesome. Then I played with it a little, and it started failing. Given that I have friends who actually give talks at conferences on…

[deleted]
Post reply on HN