Skip to content Skip to sidebar Skip to footer

Can Web Offline App Access Local File?

Hi guys: I am woking on creating a offline-web application. I hope it can be run in UIWebView(iOS) or WebView(Android). I don't know if it does work. The html and javascript file

Solution 1:

There is local storage, and it works like a database. Here's a nice tutorial.

http://html5tutorial.net/tutorials/working-with-html5-localstorage.html

You'll have to load the images dynamically though using the Image() object. The browser should cache images in offline mode though...

This question looks pretty similar to what you're looking for:

Can you use HTML5 local storage to store a file? If not, how?


Solution 2:

I use the Web SQL db (which can have a max storage of 50MB on iOS; variable size in Android) for local image storage. I serialize the images as base64 (on the server side, but could be done client-side as well) and store them in the sqlite db as text. It's not unlimited storage, but it beats 5MB.


Solution 3:

You may want to take a look at this project http://www.phonegap.com/ as a possible longer term solution for the problem of accessing device files. What this system does is provide you with a javascript API for some of the devices actual hardware features, possibly including the file IO you would need to manipulate large files. Its been an open source project that has been around for quite some time, but has some tradeoffs, like you have to actually deploy a separate binary to each target OS. :-/


Post a Comment for "Can Web Offline App Access Local File?"