Loading image files from Documents folder into UIWebView on iOS
Hello,
Is there a way to access an image file in the iOS Documents folder (<app_home>/Documents) from a local web page displayed in a UIWebView, using a relative path?
I can access an image stored in the Resources directory structure using something like:
<img src="app://Resources/images/img.jpg">
But if I now put that image in the Documents folder, I can't figure out how to access it. I've tried:
<img src="app://Documents/img.jpg">
<img src="/Documents/img.jpg">
<img src="Documents/img.jpg">
…none of which work. The only thing that does work is to use the absolute native file path, but obviously that's not practical.
Thank you!
Daniel
1 Answer
-
you can use the command 'nativePath' to address.
var bar = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'myProtokoll.pdf'); var urlinweb = bar.nativePath;
Rainer