Reputation: 1315
We are developing a Windows 10 cordova app. As per our requirement we have added a Web View (<x-ms-webview id="id-web-view" height="100%" width="100%"></x-ms-webview>
) inside an HTML page and loading resources (HTML, JS, CSS etc) inside Web View from AppData\Local\Packages\LocalState directory. HTML, CSS, JS and other resources are loading perfectly fine.
We are not able make any AJX call from web View (embedded page). Getting Error- XMLHttpRequest: Network Error 0x80070005, Access is denied. AJAX calls are woring fine for parent HTML.
Seems its a CORS issue. I have tried various JQuery and other option to enable CORS. Its not working.
Any kind of help will be appreciated.
Upvotes: 6
Views: 1335
Reputation: 67
Customize the content security policy in the meta tag http-equiv="Content-Security-Policy" as needed. Add 'unsafe-inline' to default-src to enable inline JavaScript. For details, see go.microsoft.com/fwlink/?LinkID=617521 add meta tag http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"
Please visit http://taco.visualstudio.com/en-us/docs/cordova-security-whitlists/
Upvotes: 1
Reputation: 10841
To enable CORS, simply add the response header "Access-Control-Allow-Origin: {your domain} or {*}" to your server side's website.
The steps of adding response header is dependent on your server. You can refer to CORS on the server for most used servers.
Let me know, if the server by your side isn't in that list, or some other specific problems appear.
Upvotes: 0