cordova - Best approach to store pages for an offline application -


this first mobile application experience. client of ours has requested developing application displays static data website in mobile application. planning use phonegap.

the application contain listings (ex: city attractions list) , pages (city attraction page). should use database or export pages html? suggestions?

from wikipedia:

phonegap applications use html5 , css3 rendering, , javascript logic

what mean have 2 possibilities, whether client's data in application meant modified without application update or not. since cannot determine information gave in question, i'm going detail answer each case.


if client's data not need updated (without update of application)

in case, consider client's data static. provenance of data not relevant, include in application data, other text or image (or other asset), before distributing application. means listings of client tied application, , modifying them require update application.

technically means add client's data static file. can html5 code, right in middle of own application code, or can kind of file (for instance json), application have parse , display (using javascript).

however, if go html5 solution, maintainability purposes (and maybe other reasons), want separate content client content application. so, create html5/css3 page contains client's data, , include in application's page(s) using that method (or can use pager.js library mentioned in this answer).

as side note: next method perform 1 in present case; downside of being bit more complex.

if client's data needs updated without update of application

in case, consider client's data dynamic. provenance of data relevant, method fetch data stored in application: rest done device execute application. while more complicated achieve, method has advantage of allowing constant update of data without requiring update of application.

technically means describe application layout , (graphical) design in html5/css3, , code application behavior (fetching client data, storing it, querying it, displaying it, etc.) in javascript.

to so, need fetch client's information using javascript (embedded in application's html5 files) , use javascript again store these information in phonegap storage. then, application need query phonegap storage (still using javascript) access stored information , display it, according layout/design described in html5/css3 files (probably html5 skeleton in application client data logical layout, css3 ids , classes design/appearance).

it worth noting if have always-online device, long client's website up, don't need store listing information in application. if client's website goes down, or if device goes offline, need local storage.

bottomline

in other words, if application never requires internet connection work, safe include listings within html5/css3 data; otherwise, need go javascript/phonegap storage solution, though it's more complex.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -