Boy I'm really struggling with this one!
So I have a WinRT Metro application that has an HTML webpage embedded into a webview within the application. In the HTML page there is a div with an href to a localhost url. I'm using this localhost call to communicate with a .NET desktop application that is listening for this url on a localhost port.
When I build the application (as debug or release) in Visual Studio (2015, update 1 or 2), the application works as expected. I can click on the div, the url is fired, and the communication is successful.
However, when I package the application and sideload it on to my machine, the functionality does not work as expected. I can click on the div...but the url is never fired.
HTML Url Example ([...] = code removed):
<a href="http://localhost:8123/?Api [...] >Click here</a>
Codebehind Navigating to HTML Example:
this.webView.Navigate(new Uri("ms-appdata:///local/index.html"));
XAML Webview Instantiation:
<WebView x:Name="webView" Grid.Row="1" ScriptNotify="webView_ScriptNotify" Grid.Column="1" Visibility="Collapsed"/>
Here are the things I've tried:
Has anyone experienced this before? It seems to be some sort of bug with the packaging process. Any suggestions/tips/answers are welcome! Thanks!
And just in case you're wondering, this application is intended for enterprise use only within the company I work for and will not be uploaded to the Windows Store.
Normally, you can't open a loopback connection in a UWP store app. Full stop. If you're side loading, or in an enterprise environment, there is a workaround:
https://msdn.microsoft.com/en-us/library/windows/apps/dn640582.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With