10-21-2013 05:47 PM
Is there some configuration setting I need to use to get Webworks (on BB10) to cache images served from a server?
I have a BB10 Webworks application that dynamically adds and remove html from the DOM. Images referenced in <img> elements load as expected, but if the element is removed from the DOM and, later, added in again, Webworks reloads the image file from the server rather than using a cached version. (I can watch it happening in Web Inspector.)
If I run the code in a Chrome browser on Windows, it behaves properly, using the cached copy of the image when the new element is added to the DOM.
The HTTP Resonse headers from the server are:
Date:Mon, 21 Oct 2013 21:18:34 GMT
Expires:Wed, 20 Nov 2013 21:18:34 +0000
Last-Modified:Mon, 04 Feb 2013 17:20:13 +0000
So, with the Response codes above, Chrome caches the image as expected, while BB10 Webworks reloads it from the server each time (no caching).
I'm running on a Blackberry Z10, Model number STL100-3, Software Release 10.1.0.4181, and the app is created using Blackberry 10 Webworks SDK 188.8.131.52.
What am I missing?
Solved! Go to Solution.
10-23-2013 09:33 AM
Thanks for your question. The WebView object used within a WebWorks application does not have its own cache system, like that which is built into a fully-featured browser.
For remove content loaded in a WebView, it will always be "fresh" content.
Otherwise, I would recommend using something like HTML5 AppCache, or create your own caching system (e.g. to the file system or LocalStorage)
10-25-2013 11:38 AM
e", 0, "true");
However - there is a catch. This is an unsupported API, that is mainly used by the platform but rarely by developers, and therefore is subject to change (but low likelihood). I'd recommend using this technique at your own risk.
10-25-2013 12:58 PM
Thanks for the reply.
10-25-2013 02:21 PM
Here is an example of an extension that uses the qnx object:
Specific location where it is being used:
What is your comfort level writing / using native extensions? You would have to craft your own, to interact with this API.
10-25-2013 02:52 PM
That's disappointing. I am porting an app to webworks that I already have running on Android and iOS under phonegap. Webview caching just works on those systems. I tried to use phonegap for BB10, but ran into enough problems that I decided to try webworks directly.
I've no experience at all with bb native extensions.
Do you know if phonegap/cordova for BB10 supports webview caching?
10-28-2013 04:47 PM
I've logged an issue with Apache to add this feature to cordova.
10-28-2013 05:11 PM
Thanks for looking into this.
You might like to know that the cordova instructions for deploying apps to blackberry10 don't seem not work. I have tried to deploy the cordova demo app following the steps shown at http://docs.phonegap.com/en/edge/guide_platforms_b
There is a thread on stackoverflow at http://stackoverflow.com/questions/19315236/adding
Do you have any suggestions for that would help me deploy to bb10, or can you point me to a better set of instructions?
Any help would be appreciated.
10-29-2013 10:26 AM
The issue you described was reported on some WIndows systems and has since been fixed. It will be available in cordova 3.2, which is scheduled to be released early next month.
It is a relatively simple fix which you could apply to platforms/blackberry10/cordova/init.bat
10-29-2013 03:20 PM
Thanks for that fix. Unfortunately, it didn't work for me. I changed init.bat as indicated, but I still get the same message that "node cannot be found in path".
My bat-file skills are rusty, but I fiddled with the init.bat file some more and it appears that the SET command is not behaving as I would have expected. After the line (approx line 34):
I added the line:
ECHO setting FOUNDNODE=[%FOUNDNODE%] [%%~$PATH:X]
the output shows
setting FOUNDNODE= 
setting FOUNDNODE= [C:\Program Files\nodejs\node.exe]
It seems that FOUNDNODE is getting set to some empty value rather than the proper path value. I'm running Windows 7(x64).
As I said, my bat-file skills are rusty, but have you ever seen something like this before?