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:
- Followed the “Develop with WebView” guide to implement a WebView
- I’m able to load and show the app from an external source / web page
- I copied our app into the folder “assets/raw/localUiBackup”
- Set “allowFileAccess” to true (while it’s not needed as per documentation)
- Use the local file via “file:///pkg/assets/raw/localUiBackup/content.html”
- 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