since the last weeks I've been immersed in the development of mobile applications. What I want to do is use Phonegap to cache Json-Files for WebApp to work, even if there is no Wi-Fi or Internet connection. I am very puzzled. I read a lot of questions about offline caching. But I donβt understand how to use, for example, cached Json-Files to render my web application offline.
I always thought this could work as follows:
Say I have a website that is responisve. The content of this site is dynamically generated based on Json-Data.
Now I want to transfer this site to a mobile device. I start with Phonegap. I am writing my first simple web browsing application or InAppBrowser that hosts my site. Now I want this application to work even offline based on cached Json-Data. That's where I hang in the air. I don't know anymore. Am I requesting Json-Data and storing this data in the local file system of my device using PhoneGap File-Api? And how to use this data to build my layout. As I understand it, I have PhoneGap as a container that makes a bridge between my WebSite answer (HTML5, CCS, JS) and my own functions. So I understand that I can upload my site to the PhonGap container, and it looks a lot like an application. But when I'm offline, I have to cache data. Most importantly, the Json-Data on which the markup is based. How can I download Json-Data from my local device and use this data for rendering? Today I created a simple application using PhoneGap with InAppBrowser. Then I did not find a tutorial on how to cache Json-Data, which was pulled by my responsive site. I could see that this data was used (via Fiddler as reverseepxy). Therefore, this data must be transferred to InAppBrowser. I thought I understood something. maybe i need to include everything in index.html (i use eclipse and phonegap and android). Can someone tell me with a simple example how I can name my site, cache Json-Data (large files, up to 100 MB on a local device using PhoneGap File-Api) and use this Json file to render my website in offline? Is it possible?
Update: I found this post on the Internet that can be customized to suit my needs: is the code from this example here is the code from index.html or is this code used on the website? Should I also include cordova.js on my website?
Thank you very much in advance.
source share