styl
June 10, 2022, 10:21am
1
Hi,
I built an app and I’m using Webview source uri. I am testing it on Android, iOS and web.
While it runs smoothly on iOS, in Android it shows a white screen and in expo web it shows the following errors. What should I do?
*If this question seems unrelated pls ignore-delete it.
wodin
June 10, 2022, 2:17pm
2
Hi @styl
Could you post some example code that we can try ourselves? Otherwise it’s a bit hard to know what’s wrong.
But off the top of my head, you might have a CORS issue.
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by...
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.
A web page may freely embed cross-origin images, stylesheets, scripts, iframes, and videos. Certain "cross-domain" requests, notably Ajax requests, are forbidden by default by the same-origin security policy. CORS defines a way in which a browser and server can interact to determine whether it is safe t...
1 Like
styl
June 10, 2022, 4:29pm
3
I will explain it simplier.
That’s the code I want to run. To Webview a uri link.
For this link Webview works fine in Android.
For below link as example Webview is not running on Android nor Web (White screen appears), but is running on iOS.
uri: ‘https://boostup-app.herokuapp.com ’
I can’t find what’s causing it. Thanks for help
styl
June 11, 2022, 6:48am
4
I just figured out what is happening.
I run the uri link on “Webview Test” app.
As you can see the problem is loading the posenet model from googleapis.
Is there a way to handle this fail?
wodin
June 11, 2022, 7:38am
5
Sorry, I don’t know.
I can download e.g. http://storage.googleapis.com/tfjs-models/savedmodel/posenet/resnet50/float/group1-shard12of23.bin from the command line using curl without any cookies or authorization headers etc. so I don’t know why it might be a problem from the WebView.
If I check the headers of the response it contains:
Access-Control-Allow-Origin: *
so I think that means there shouldn’t be a CORS problem with those URLs.
If nobody else here has any answers for you you might want to ask the React Native WebView project for help. Or maybe Stack Overflow.
1 Like