I have a windows 8 hybrid app and now I want to migrate it to UWP. I am facing two issues and I have been searching on the internet for quite a few time. I want to know if UWP support ajax function. Also my anchor tag in href is not parsing. What might be the reason.
问题:
回答1:
I want to know if UWP support ajax function
The answer is yes, you can use ajax in UWP Application. But there are a few things you need to notice when using ajax in UWP.
If you are using ajax to get data from a remote server, please make sure the
Internet(Client)
capability is enabled inpackage.appmanifest
. If you also want to call ajax from local server, make sure thePrivate Networks(Client & Server)
capability is enabled.If you are using a Content Security Policy in your app. Make sure the server address of your ajax call is included after
default-src
orconnect-src
in<meta>
. For details about CSP you can refer to this document.Cross-Origin should also under your concern when migrating. For enable CORS you can refer to add CORS support to server.
my anchor tag in href is not parsing. What might be the reason.
For safty reason, UWP doesn't support inline javascript. So codes like <a ng-click="jsfunc();"></a>
won't work. Please add eventListener in JS files.