Access local files in webview via fileURLWithPath
With the iphone sdk you can access local files inside a webview using fileURLWithPath. What is the equivalent in the API if any?
4 Answers
-
Just use the 'url' property when constructing a webView.
If a file 'local_web.html' is in your Resources folder, you could simply use:
var webview = Titanium.UI.createWebView({ url:'local_web.html', height:'auto', width:300, borderWidth:1, top:10, borderColor:'#eee' });
-
I get that. what I mean is that the webview opens a page and that page has images. Thos images are referenced now as /images/pic.jpg , etc. With those images living on the web server. I wan to load those in the app and then have the webview retrieve them from the app instead of the server.
-
OK. You could download the images from your webserver to your app data directory then reference them there in your local webview html.
Get your app to create a folder called 'images' and then download them to there.
With a bit of string.replace and regex work you should be able to then alter the html to whatever you want.
Is that what you mean?
-
no, not exactly. THe html is on the server and the images are not.