GMail for HTML5: Loading code via comments

September 20, 2009

Google has been running a series on the Google Code blog about their mobile client. Since Webkit now supports some of HTML5, apps that target iPhone and Android are actually the frontier of HTML5 development. The entire series is worth reading, but I found Reducing Startup Latency particularly interesting.

They didn’t want to parse all their JavaScript at once, causing a big delay in startup, and they didn’t want to download it on demand because of high network lag. Their solution: hiding JavaScript in comments and parsing it by finding it in the DOM and using eval(). Quite the hack.

© Allen Pike. See also Twitter and Steamclock.