'file://' has been blocked by CORS policy. issue is present on most of the android devices

Hi Team,

I am using ionic3 for my application development. I am getting below error for android application for the first time installation. Then after re launching the app is working correctly.

Access to XMLHttpRequest at ‘’ from origin ‘file://’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

software specification is:-
cordova 9.0.0
ionic 3
Android platform 8.0.0
Node 10.15.3
Angular 4
plugin list :-
cordova-plugin-camera 4.0.3 “Camera”
cordova-plugin-compat 1.2.0 “Compat”
cordova-plugin-device 2.0.2 “Device”
cordova-plugin-firebase-lib 3.3.0 “Google Firebase Plugin”
cordova-plugin-geolocation 2.4.3 “Geolocation”
cordova-plugin-inappbrowser 3.0.0 “InAppBrowser”
cordova-plugin-insomnia 4.3.0 “Insomnia (prevent screen sleep)”
cordova-plugin-ionic-keyboard 2.1.2 “cordova-plugin-ionic-keyboard”
cordova-plugin-ionic-webview 1.1.19 “cordova-plugin-ionic-webview”
cordova-plugin-market 1.2.0 “Market”
cordova-plugin-network-information 2.0.1 “Network Information”
cordova-plugin-screen-orientation 3.0.1 “Screen Orientation”
cordova-plugin-splashscreen 5.0.2 “Splashscreen”
cordova-plugin-statusbar 2.4.2 “StatusBar”
cordova-plugin-whitelist 1.3.3 “Whitelist”
cordova.plugins.diagnostic 4.0.8 “Diagnostic”
es6-promise-plugin 4.2.2 “Promise”
info.protonet.imageresizer 0.1.1 “Image Resizer”

Solution tried:-
1. whitelist plugin restricted to 1.3.3
2. added below lines





3. checked for upgrading webview and whitelist plugin as well.
Nothing worked.

Please suggest for changes if needed. even in production build we have not done any change in Backend or frontend. But, it is happing on production old working application as well. Please help us to fix this.

1 Like

same issue here did you find any solution

What are trying to do?
Add some code please.

EDIT: Bug is to do with the latest version of Google Chome. 991107 - chromium - An open-source project to help move the web forward. - Monorail

Seeing a similar issue only on a new/fresh install of the app. Restarting the app resolves the issue which is strange.

I have a feeling it is to do with a new version of Android. (I’m on 9, 1 July 2019 security patch level, kernel version 4.4.153-perf+, Nokia 9) as old builds of the app have the same issue.

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

The “Origin: http://” header does not appear to be sending to the server.

the services are working which have Access-Control-Allow-Origin=* in the response header. this I understood till now. Please keep us posted. If any one is getting the solution.

Ionic app uses WebView because it’s a hybrid App. WebView is nothing but a Chrome browser without address bar on Android and Safari browser on iOS.

Recently Google has updated chrome to 76 version due to which WebView is not working first time. WebView needs to be restarted then only it will work that’s why it works on second launch after killing the app.

Below are the links which justifies this and Chrome 76 update has broken many things for Google themselves:

https://support.google.com/chrome/thread/11089651?hl=en

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

@PriyaS1 we are having this issue right now - Android apps using Chrome 76 won’t work until you kill them and re-start :frowning:

Hi everyone, the issue is resolved from Google side. Please update you’re chrome for new version of chrome

Which version? The latest version in the Android Play Store is still the bugged version?

I’m also getting the same issue ,

Cordova android @8.0.0

Issue :

Access to XMLHttpRequest at ‘’ from origin ‘file://’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

WebView needs to be restarted then only it will work that’s why it works on second launch after killing the app.

This is happening in production apk build,

Please let us know any solution to come out of this issue .

The new version is 76.0.3809.111. some people got the update. Some are still pending. Let’s wait for 2-3 days

1 Like

Thank you @PriyaS1 will be waiting for your next post or reply.

Hi @PriyaS1 and @Maheshvy,

I am also facing the same issue. i have updated the google chrome then it is working fine, But my application on Production they are more than 2k users, It will be difficult to ask all of them to upgrade the google chrome
is there any other way, we can do it on app itself. I am trying to upgrade the webview in application but nothing working. Please suggest something, Thanks in Advance

Actually we are using chrome as webview now.then it’s not possible. And this the 3rd party issue. We can’t do anything from our side. If you wanted to do dirty fix then you can forcefully close the app for the first time and then restart the app again. Then again you need to publish application.

Thank you @priya, I am trying to find some solution to update the webview from cordova. If any luck I will let you guys know.

From the comments it sounds like the fix is being rolled out? https://bugs.chromium.org/p/chromium/issues/detail?id=991107

Hi guys,

I added cordova-plugin-crosswalk-webview in my application after that i am able to login without google update

Thank you

@abisiya ,
cordova-plugin-crosswalk-webview - this creating different type of apk (around 5 apk) , sorry not able to understand how it will fix

@richardshergold
As we tested still same issue persisting , please let us know ASAP if any solution .

@Maheshvy you can use armv-7 folder apk, Old cordova version used to create this apk,
If you are using this apk you don’t want to bother about google version, because it is creating own webview and not using google web view

@abisiya

thanks for your quick reply ,

But we have recently android version released like 32 bit and 64 bit android architecture version for SDK 28 , this will taken care by armv-7 folder apk ?