Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Basic Caching

hey guys,

I need a very basic example of caching on webworks for a BB app which will save a previously loaded (from the internet) string for use later on. 

I looked at the "weather app" example but its too complicated for a beginner like me to just understand. 

Its kinda urgent so I'd appriciate ant help anyone can offer.

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Basic Caching

Hi dilesw,

 

The easiest way to persist one piece of data is HTML5 Local Storage. Check out the API - http://www.blackberry.com/developers/docs/webworks/api/localStorage.html



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Re: Basic Caching

I'm actually working on OS5 and this onlysupports playbook... Smiley Sad thanks for the help though!

Developer
Posts: 163
Registered: ‎05-06-2011
My Device: Playbook
My Carrier: Not Specified

Re: Basic Caching

If you are planning to save the data to device then you could use HTML5 database. See these links for details

 

http://www.blackberry.com/developers/docs/webworks/api/Database.html

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Supporting-Gears-using-HTML5-in-...

 

You could also use File API to write data into file. http://www.blackberry.com/developers/docs/webworks/api/blackberry.io.file.html

 

Contributor
Posts: 25
Registered: ‎06-03-2011
My Device: curve 9800
My Carrier: Singtel

Re: Basic Caching

Thanks for all the help guys,

But I'm still quite stuck as I was when i fist asked you guys. 

I used the structure of the sample app, but I have no way of testing it.

When I use chrome I get a error saying: " Origin file:// is not allowed by Access-Control-Allow-Origin."

 

And when I tried to run it on the simultor it said the browser does not suport databases.  The simulator is a BB9700 using OS 5.0.0.469

 

Can someone help me with a basic app that would merely access a URL and store the content of the destination in any form/location that can be accessed later when there is no interet connection.

 

Thanks!

Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Basic Caching

Hi dileshw,

 

If you want to get it running from chrome I believe you will have to run it with one or both of the following options "--allow-file-access-from-files", "--disable-web-security".

 

As per the 5.0 simulator not working, please check that you are building the app with the newest SDK and you are simulating an SD card by going Simulate>Change SD Card and making sure there is an entry there.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)