10-01-2012 11:27 AM
How i can Storage data on WebWorks app using Blackberry OS 5.0 ?
10-01-2012 04:23 PM
in OS5.0 you can not use LocalStorage, so cookies is one possibility.
You can also check google gears, it brings some more functionality, I'm not sure if some sort of localstorage is included.
10-02-2012 02:48 AM
Have you seen this:
https://developer.blackberry.com/html5/apis/databa
Its for BB5+
10-02-2012 03:45 AM - edited 10-02-2012 03:46 AM
I would recommend writing a small gears wrapper - that exposes a local storage interface but uses gears underneath. Something along the lines of:
(function()
{
if (!window.localStorage && google.gears)
{
var db = google.gears.factory.create('beta.database');
db.open('BackboneLocalData');
db.execute("CREATE TABLE IF NOT EXISTS persist_data (key TEXT UNIQUE NOT NULL PRIMARY KEY, value TEXT NOT NULL)").close();
var localStorage =
{
clear: function ()
{
db.execute('begin').close();
db.execute("DELETE FROM persist_data").close();
db.execute('commit').close();
},
setItem: function (key, value)
{
db.execute('begin').close();
db.execute("delete from persist_data where key = ?", [key]).close();
db.execute("insert into persist_data(key, value) VALUES (?, ?)", [key, value]).close();
db.execute('commit').close();
},
getItem: function (key)
{
db.execute('begin').close();
r = db.execute("SELECT value FROM persist_data WHERE key = ?", [key]);
ret = r.isValidRow() ? r.field(0) : null;
r.close();
db.execute('commit').close();
return ret;
}
};
window.localStorage = localStorage;
}
})();One small issue with the above script: you wont be able to use square brackets with local storage. Iow you have to go localStorage.getItem("somekey") rather than localStorage["somekey"].
a week ago
All OS 5.x and some 6.x versions don't support localStorage, try my polyfill:
[]'s
Racum