Hi Friends,

This article will take you through the ways of handling Web Service and Persistent Storage in Palm Web OS.

First let us look at Web Service.

Web Service

1. We can access webservice using two means.
a. Prototype Javascript Framework (Ajax.Request)
b. Native javascript (XMLHTTPRequest)
2. Exchange data can be of any form (JSON, XML, or any of your own format)
3. Currently only asynchronous operations are supported using XMLHTTPRequest, done to preserve UI responsiveness. (I have not checked with the Ajax.Request. If someone has verified it, please share them)
4.Use Prototype Javascript Framework if you don’t wish to control every operation yourself and the framework will take care of everything.
5. use Native Javascript if you wanted more control over your code.

Processing JSON:

1. Two ways:
a. eval()- best to avoid, only if source is trusted.
b. JSON parser- faster, never allow malicious script to get executed.

Processing XML:

1. use either DOM or a SAX parser.

Now lets turn towards, Persistent Storage:

Memory is partitioned as three segments:

1. root- for the OS and apps that come by default like calendar, Browser.
2. var -meant for third party Applications, that we are wiling to develop.
3. Media-media partition are visible on the USB volume( Available in your computer, when you plug-in your Palm based phone- pre or pixi).

Three ways to store data:

1. Cookie
2. Depot
3. HTML5

All three forms of data are tied to an application. So, they will be deleted, if you delete your application from the device.


1. Data stored as a key-value pair.
2. It has nothing to do with the Web browser cookie, other than storing data.
3. Maximum of 4KB of data.
4. Can be used to store preferences, simple settings.


1. Can store up to 1 MB of data.
2. Size can be extended by using a keyword ext,while creating database.
3. Data stored as Key-value pair.
4. Normal way of creating DB:
var db = new Mojo.Depot({name:”demo”}, onSuccess, onFailure);
5. For extended storage:
var db = new Mojo.Depot({name:”ext:demo”}, onSuccess, onFailure);

HTML 5 database

1. It is a structured database, unlike the first two.
2. Normal way of creating the DB:
this. db = openDatabase(“myDB”, 1, “My DB”, 10000);
3. To store data in Media partition, use
this. db = openDatabase(“ext:myDB”, 1, “My DB”, 10000);

Depot and HTML5 DB operations are asynchronous, unlike the Cookies.

And thats all for this article. Thank you.