230 Chapter 8—Web Storage and Offline Web Applications
z Combine with Geolocation API. This expansion takes our example a bit
further: After locating the player’s current position with sufficient accuracy
(see Chapter 7, Geolocation), a corresponding Google Maps map section
could be loaded. The player’s task would then be to find his own location
on the map as accurately as possible. In this variation, the game is no
longer offline-capable but is definitely suitable for mobile devices.
Summary
In this chapter you encountered two different types of client-side storage: web
storage, a structured storage for reading and writing web applications, and of-
fline storage, temporarily saving entire web applications or parts of them on the
client side.
The chapter concluded with a programming example, the game Click to tick!,
demonstrating the strengths of the offline cache and localStorage. By using the
two new techniques, we created an application that could run on the web brows-
er but was still fully functional without Internet access. The automatic update
function was the icing on the cake. The user did not have to worry about installa-
tion, nor did the user need administrator rights.