0

I have a PhoneGap application in which I need to download certain images for offline usage and show those inside an iframe. Is this possible and do I need something like CorHTTPD (https://github.com/floatinghotpot/cordova-httpd) to serve the assets locally?

I have been trying to store the files on file system but when I try to show those (even without being inside iframe), those doesn't show. They seem to be loaded (can be seen in network console in remote debugging), though, but (of course) without any headers.

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
  • Are you sure about the files been stored in device and your able to access using the filesystem path of image. – codebreaker Dec 16 '14 at 07:04
  • Yes, I am sure about that as I also download other stuff successfully and as said, I can see those in network traffic also as successful with it's data. – Roope Hakulinen Dec 16 '14 at 07:22

1 Answers1

0

After spending more and more time on this and settings GapDebug correctly to remote debug my application, I was finally able to solve my problem by giving

{responseType: "arraybuffer"}

to AngularJS's $http.get method as config parameter as described here. Now I am able to get the images to ArrayBuffer correctly and from there to base64 encode them to be added inside HTML stored offline. Suitable solution for my case at least..

Community
  • 1
  • 1
Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66