Cannot Initialize app - Access to XMLHttpRequest has been blocked by CORS policy

1
Hi all, When trying to run a hybrid app which is hosted in the SAP cloud I get a “Cannot initialize app” error. When debugging I get to see the following information Syncing and starting up index.html:1 Access to XMLHttpRequest at 'https://???????????.hana.ondemand.com/components.json?1565176195811' from origin 'file://' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. bundle.js:1 Failed to sync and startup bundle.js:1 Error: Failed to sync and startup.   Does someone know what exactly is going wrong there and how to fix it? best regards, Fabian
asked
3 answers
3

Hi Fabian, it turns out it's a bug in webview v76 on android. I can confirm that if you install chrome beta on your android device and use v77 for webview implementation, then the issue does not occur. 

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

answered
2

I was able to briefly reproduce this issue with one of my apps running in the SCP (and only one). I believe it must have been a brief partial outage of the SCP.

answered
1

Hi Fabian, your hybrid app does not have access to that resource, and you probably need to make changes to the whitelist plugin in your phonegap config.xml, i.e.

<allow-navigation href="*://*.hana.ondemand.com/*" />

 

answered