Building an API from
the HTML-Only
Version of Gmail
T
he problem with reverse engineering web applications —
other than the complexity — is that they never stop evolv-
ing. That’s the advantage of building an application on the
web: It costs nothing to ship an upgrade to all of your users. Such
upgrades, as mentioned previously, do, however, tend to break the
third-party APIs that this book relies on.
The one thing worse than breaking an API is making it redun-
dantly complex, and about halfway through writing this book,
Gmail did just that by releasing a plain HTML version of
the site. Gmail users approaching the site with an old, non-
JavaScript–enabled browser are able to access a version of the
application that does not rely on the JavaScript techniques dis-
cussed in previous chapters. The functionality is a little restricted,
but the basic capabilities to read, write, and organize your mail
are there. This chapter, therefore, looks at faking an API by
scraping the HTML version — something somewhat simpler
than messing with the JavaScript API.
A First Look at the HTML Version
To see the HTML version of Gmail, turn off the JavaScript in
your browser, and log in as normal. (Or, you can log in and switch
from standard view to basic HTML by using the choices at the
bottom of the page. Either way is good.) You should see some-
thing very similar to Figure 13-1.
̨Gmail from an
HTML perspective
̨Basic scraping
chapter
in this chapter