Access to local data storage is a signature feature of native application models. Web applications do not have access to local data storage other than browser cookies. Recently, there has been an effort to address these needs, particularly with the proposed HTML 5 APIs for structured client storage.
Palm webOS supports the HTML 5 Database APIs and provides two specific APIs for simple data creation and access:
You will have to evaluate your needs to determine which solution is the best.
Cookies are best used for synchronous access to small amounts of data, such as preferences, version numbers, and other state information.
Both HTML 5 databases and Depot are intended to support caches for offline access and to help with performance issues while accessing online data.
Depot is recommended for storing simple objects without a schema design or manual transaction and query handling; otherwise, use an HTML 5 database.
For disconnected applications that require a data store, an HTML 5 database is the best solution.
Whichever solution you select, it is critical that you provide some local caching for offline use, as stale data is better than no data for most applications. Conversely, you should provide a dynamic source for your data, as it’s best to update the source data when the device is connected. Applications that can refresh their data or use online storage instead of the device storage will be more flexible in the long run.
In this chapter, both depot- and cookie-based storage will be covered
in depth, with examples shown using the sample News application. The HTML 5
APIs will also be summarized with guidelines on using these APIs and where
to find more information. Finally, we will revisit Prototype’s Ajax
functions. Chapter 3 included an example using the Ajax.Request
method to update the news feeds. In
this chapter, you will get some information on each of the Ajax methods and
response handling.
18.191.135.214