In our quest to build an Android app without Java, we’ve discussed how to use CSS to style a collection of HTML pages to look like an Android app. In this chapter, we’ll lay the groundwork to make those same pages behave like an Android app. Specifically, we’ll discuss:
Using Ajax to turn a full website into a single-page app.
Saving the app as an icon on the home screen.
For example, if you are loading external pages dynamically, the browser will not give any indication of progress or errors to the users. Furthermore, the Back button will not work as expected unless you take pains to support it. In other words, you have to do a lot of work to make a sweet Ajax app. That said, the extra effort can really pay off, because Ajax allows you to create a much richer user experience.
For the next series of examples, we’ll write a single page called android.html that will sit in front of all the site’s other pages. Here’s how it works: ...