Access an HTML file from the assets via WebViewer for iOS

In Android we can access an HTML file from the assets (APK) via WebViewer like this:
file:///android_asset/test.html or

But how's that for iOS? There (as far as I know) it must be accessed via the NSBundle class.

1 Like

I'll have to double check the code, but if I recall correctly the file:///android_asset/ method is supported but not yet the http://localhost approach.

Edit: Yes, adding http://localhost support to the webviewer is issue number 518, and it's assigned to me :smile:


What a strange path:


1 Like

Would this path also work with the compiled app (ipa)?
If so, what would the path be?

Yes, that logic is implemented as part of the WebViewer component itself in iOS, whereas in Android it's baked into the Android WebView. Therefore, on iOS we have complete control over how to interpret that URL.


Similar case.

In Android I had this code distinguishing if I was developing or not:

Now I don't know which direction to put the WebViewer

For iOS, you can currently use the file:///android_asset/ form, and in the next release it will also allow the http://localhost/ form, which should work on all App Inventor platforms whether you are running in live testing or compiled apps.