Does UWP app support ajax?

末鹿安然 提交于 2019-12-11 00:57:36

问题


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.

  1. If you are using ajax to get data from a remote server, please make sure the Internet(Client) capability is enabled in package.appmanifest. If you also want to call ajax from local server, make sure the Private Networks(Client & Server) capability is enabled.

  2. 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 or connect-src in <meta>. For details about CSP you can refer to this document.

  3. 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.



来源:https://stackoverflow.com/questions/38305520/does-uwp-app-support-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!