简体   繁体   中英

Connect to Azure Mobile Services from dynamic HTML content in WebView

I am able to load the HTML/JavaScript sample provided in Azure mobile services quickstart if I follow the instructions. But that sample involves hosting the webpage on localhost.

My requirement is to display a similar webpage that communicates with WAMS in an existing windows phone application. I added the three files (index.html, page.js and style.css) into the project and navigated to index.html in a webview.

It doesn't seem to connect to azure mobile services. I added app name in CORS whitelist with no luck. Is it absolutely necessary to host the page somewhere in order to connect to azure mobile services? If not, what do I need to do?

This is a limitation of Internet Explorer in general. Example, see: https://blogs.msdn.microsoft.com/ieinternals/2012/06/19/enhanced-protected-mode-and-local-files/

Better idea is to encapsulate your page in an Apache Cordova app - this allows you to use pretty much the same stuff, but with an explicit content-security setting. At this point, you should be using Azure Mobile Apps (not Mobile Services) and there is a tutorial here: https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-cordova-get-started/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM