Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Say I have a mobile application that allows users to enter information which is then uploaded to a central location. I had planned on building this using only HTML5 and javascript (non-native app), but I'm assuming if someone is in an area where there is no service they simply will not be able to use the app.

As a work around would it be possible to write a native app that saves the information on the device and then uploads it whenever service returns? If so, is it possible to write a native app entirely in HTML5 and Javascript that does this?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

HTML 5 has a local storage feature Check that out.

It's can only store up to 5 meg (on most browsers), If that's not enough you will have no choice to with a native App.


Edit as more info is needed.

Basically there is 2 parts to this:

1) Manifest file This tells the Browser what files need to be stored locally for the web app to work offline. (Basically html and JS files)

2) HTML5 Local storage: Think of this like a local db the can be access by JavaScript.

So when a user visits your site (while online), the browser sees the manifest file and stores ALL the source files your app need to work in Offline Mode as specified in the Manifest. (of course no server side code can work offline, so this is all html and JS)

Also while your user is online, you save all the data he needs to local storage, any changes made while online needs to be updated your server and Local storage.

When offline, your user has access to all the html and JS he need to run his app, he also has access to the HTMl5 Local storage. He can do what ever he wants (whatever you coded for him to be able to do offline). All updates as saved to the local storge.

Once back online, he visits your site again, you see he made changes offline and you sync up the local storage with the server.

Check out this demo and read this Entire book

share|improve this answer
    
Very interesting. So people would still need to download the app from the app store, but it could stay a HTML5 app? –  Abe Miessler Feb 17 '12 at 17:54
    
NO! Local storage is an HTML5 feature! No downloads.. (read the link). If you need more than 5 Mb, you need abandon the HTMl5 strategy altogether. –  Morons Feb 17 '12 at 17:55
    
I understand that, but if I want people to use the app when there is no service, they would have to have it downloaded to their phone right? I'm assuming the only way that happens is if they download it from the app store before they loose service? –  Abe Miessler Feb 17 '12 at 17:59
    
Also, if anything I'm saying here does not make sense please let me know. I have no mobile development experience, I'm just trying to formulate a strategy. –  Abe Miessler Feb 17 '12 at 18:00
    
Abe.. See my edits –  Morons Feb 17 '12 at 18:12
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.