Webview, load local file url and additional files

Hi,

I try to load a local file URL stored on the device into a WebView. The entry point would be called content.html. The first step of accessing and loading the content.html file is working. But I reference another file in the content.html, which cannot be loaded by the WebView.

Here is what I have done so far:

  1. Followed the “Develop with WebView” guide to implement a WebView
  2. I’m able to load and show the app from an external source / web page
  3. I copied our app into the folder “assets/raw/localUiBackup”
  4. Set “allowFileAccess” to true (while it’s not needed as per documentation)
  5. Use the local file via “file:///pkg/assets/raw/localUiBackup/content.html”
  6. Checked if files are present in “build/private/vega/armv7/Debug/assets/raw”. They are present

Log:

 (NOBRIDGE) LOG  onLoadStart url:  file:///pkg/assets/raw/localUiBackup/content.html
 (NOBRIDGE) LOG  onError url:  file:///pkg/assets/raw/localUiBackup/config/build.info.json
 (NOBRIDGE) LOG  onLoad url:  file:///pkg/assets/raw/localUiBackup/content.html

WebView config:

<WebView
      style={styles.webview}
      ref={webRef}
      hasTVPreferredFocus={true}
      allowSystemKeyEvents={true}
      source={{ uri: sourceUri }}
      javaScriptEnabled={true}
      mixedContentMode={"always"}
      allowFileAccess={true}
      domStorageEnabled={true}
      onLoadStart={(event) => {
        console.log("onLoadStart url: ", event.nativeEvent.url);
      }}
      onLoad={(event) => {
        console.log("onLoad url: ", event.nativeEvent.url);
      }}
      onError={(event) => {
        console.log("onError url: ", event.nativeEvent.url);
      }}
    />

Currently I don’t know what the issue could be.

Edit: Missed to say, I’m using @amazon-devices/webview version 3.3.0

Hello @Tobias

Please allow me some time to look into this issue and update you.
In the meantime, kindly share the app name / ASIN as well.

Warm regards,
Ivy

The app doesn’t exist yet. Therefore there is no registered app in my Amazon console. No app name and ASIN were created at the developer console yet.

1 Like