How to fix CORS error on WebView Chrome 76?

2020-07-19 04:59发布

I've sent request from my app to API server; on WebView Chrome 76.0.3809.89 API cannot be called The following error is shown on the log:

Access to XMLHttpRequest at 'https://.....' from origin 'file://' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

It works normally on Chrome 75. How can I disable this CORS checking on WebView Android? Or is there any other solutions

3条回答
做个烂人
2楼-- · 2020-07-19 05:24

I had the same issue with chrome version 76.0.3809.89, (I was using a hybrid app) cors erro although when I closed that app totally(it shouldn't be working in the background) and then tried again it worked.

To fix this issue you must upgrade your chrome to 76.0.3809.111. That worked for me, then it also worked for the first time without having to close the app.

查看更多
ら.Afraid
3楼-- · 2020-07-19 05:42

It seems to be the bug of Chrome 76 https://bugs.chromium.org/p/chromium/issues/detail?id=991107 Close app and run again then it worked again.

UPDATE: Chrome 76.0.3809.111 (rolled out to 100% user) fixed the problem; now just update chrome to fix.

查看更多
一夜七次
4楼-- · 2020-07-19 05:49

Getting the same issue that is chrome webview 76 issue, which is an update from 1st of Aug 2019, after that day we got this issue, that is a bug in chrome if you pass header value in ajax request in your hybrid apps then you got this issue. Now their team has rolled out

Below is the chromium update...

"The behavior in WebView should be the same regardless of whether it's being provided by Chrome or by the separate WebView package, and the update with the fix is being rolled out to both Chrome and WebView simultaneously. It's currently being released to 10% of users and will be incrementally rolled out to everyone if we don't see any new issues. So if you see one being updated and not the other that's just because it's an incremental rollout - the two packages are updated independently here so a given device can get one updated before the other. There's nothing to worry about and you should not advise users to switch implementation; just wait until 76.0.3809.111 is rolled out to all users."

more : https://bugs.chromium.org/p/chromium/issues/detail?id=991107

查看更多
登录 后发表回答