Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS Error Encountered In Android While Fetching Local File in Webview #1107

Open
trohit08 opened this issue Oct 14, 2024 · 1 comment
Open

Comments

@trohit08
Copy link

Recently in Android we are facing a CORS error while trying to fetch a local image in the webview via a Javascript file. This image gets downloaded from server at the very first instance of opening our application. Later while opening the webview from within the app, the image gets loaded from persistent datapath of Android. The following error was observed when we inspected the webview:

"Fetch API cannot load file://{path to file}. URL scheme "file" is not supported."

Need help fixing this.

@KojiNakamaru
Copy link
Member

As the error message describes, it is not supported for security reasons.

cf. https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/cors-and-webview-api.md#setallowfileaccessfromfileurls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants