GMail for HTML5: Loading code via comments

September 20, 2009 • 1 min read


This post is over ten years old. Chances are, I've learned enough to have advanced my thinking about some of this stuff.

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.


Liked this? Follow along to see what's next.

© Allen Pike. 👋🏼 Feel free to contact me.