Can we get a straight answer from an Appcelerator Developer.
There's half a dozen questions asking similar yet different things about webviews and local resources.
Can remote urls access local resources or is this disallowed
If Remote is Allowed what is the local url to call the resource
If Local, is it different to the Remote.
Can someone give a straight description of the file structure plus a valid img or script src call.
does this also work for CSS files reference by the html
So you have html from website either downloaded directly or via XHR then loaded.
I have a folder "Resources/Images/File.png", Do i Call the image by…
or something else entirely.
In this example i have used all of the above,
from a remote url AND by downloading a temp.html into the appdirectory with the following code
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'test.html'); f.write(this.responseText); webview.url = f.nativePath;
code taken from Line 68
Is this correct ?
I suspect it's not allowed - it would be a security risk for remote web pages to be able to access local files. I don't know why you'd want that anyway. If you must have it, download the remote webpage to a local file then load that in your webview. There are plenty of examples in the KitchenSink.
As Damien pointed out, lots of examples in Kitchen Sink that demonstrate this.
Remote webviews can't access local APIs - with the exception of Ti.App.fireEvent, Ti.App.addEventListener, Ti.App.removeEventListener, Ti.API.debug, Ti.API.info, Ti.API.error, etc.
You can fire events from your remote webview and then listen for them (using Ti.App.fireEvent, etc) from the "outside" … i.e. in app.js or the window that created the webview.
The creator of the webview can also evalJS against the webview instance as well to send/retrieve values directly.
I've done some digging, and found that this is where you can find files from your app, Note the triple /// it's important
It's still not available to remote sources, but at least it's something