-->

Cordova Windows Phone 8.1 with angularjs - An app

2020-07-23 06:15发布

问题:

I have an app using cordova and angularjs. Some features on the app require access to the Google Maps API and Yahoo Weather API.

When I compile to Android and iOS platforms everything works fine, but not on windows platform (windows phone 8.1). I get these errors on both calls (google and yahoo):

"**APPHOST9601** An app can't load remote web content in the local context".

I think I have the cordova-plugin-whitelist correctly configured with the proper intent, navigation and network tags on config.xml (I also have the meta tag on index.html).

Strangely if I add wp8 cordova platform and run it, I have no errors. Only on the windows platform running the windows phone 8.1 project inside the solution.

This is what I have in the config.XML

<!--Controls which URLs the WebView itself can be navigated to. Applies to top-level navigations only.-->
<allow-navigation href="*" />

<!-- Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed. -->
<allow-intent href="comgooglemaps:*" />
<allow-intent href="sms:*" />
<allow-intent href="tel:*" />
<allow-intent href="geo:*" />
<allow-intent href="*" />

<!-- Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks). -->
<access origin="https://tel:*" launch-external="yes" />
<access origin="https://mailto:*" launch-external="yes" />
<access origin="https://geo:*" launch-external="yes" />
<access origin="https://comgooglemaps:*" launch-external="yes" />
<access origin="https://*" />

<access origin="http://maps.google.com/*" />
<access origin="content:///*" />
<access origin="*"/>  and I also have this in the HTML page  <!-- Enable all requests, inline styles, and eval() -->

And in the HTML I have the following metadata

<meta http-equiv="Content-Security-Policy" content="default-src *; media-src *; style-src 'self' * 'unsafe-inline' * 'unsafe-eval' *; script-src 'self' * 'unsafe-inline' * 'unsafe-eval' *" />