HTML and CSS Reference
Figure 7-11. Final play button
Traditionally, to persist data (such as a user's name) within a mobile web
application, you would store this information within a cookie. The problem with
cookies is that while they are prefect for storing small amounts of data, they
object. This can be perfect for when you wish to store the current state of the
application so that when the users come back it it, they can pick up from where
they left off, much like a native application.
Unfortunately, local storage does not support storing objects, only string values.
But you can convert objects into strings using JSON.stringify and convert them
back into objects using JSON.parse.
To store data using local storage, simply use the localStorage APIs. These
consist of the properties and methods shown in Table 7-6.