4

I'm working on a phonegap iPhone app which downloads content from the network in the form of HTML docs with text, images, and embeded HTML5 videos.

I want to download these documents as they're available and store them locally, for further reading in offline mode. I've searched a bit and found that the optimal place to store this kind of data would be in the app's Documents folder. However, I don't really know how to access it with the Phonegap API.

I know how to create an XHTML file from js, but how do I read/write files from/to my own app's Documents folder?

Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
StJimmy
  • 504
  • 3
  • 9
  • 18
  • If only there was a way to access a photo from the device's browser cache - that would save you having to manage it yourself... – Magnus Smith Nov 26 '12 at 11:13

2 Answers2

6

you can store the in the sqlite database provided by the browser.

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/UsingtheJavascriptDatabase/UsingtheJavascriptDatabase.html

Cœur
  • 37,241
  • 25
  • 195
  • 267
Aaron Saunders
  • 33,180
  • 5
  • 60
  • 80
3

I wouldn't store the video data in a database. Also in web sql there is a 50MB limit for the entire database in IOS. I would use the PhoneGap File API to hook into the filesystem http://docs.phonegap.com/en/2.1.0/cordova_file_file.md.html#File

Also consider encrypting the videos by writing an objective c plugin or using something like RNCryptor https://github.com/rnapier/RNCryptor

refugene
  • 383
  • 2
  • 16