I am using following web view in xaml.
<WebView x:Name="FBCommentsTest"></WebView>
And i am trying to embed HTML data to that web view in the following way in the c# end.
FBCommentsTest.NavigateToString("<html><head></head><body><div id=\"fb-root\"></div><div id=\"fb-root\"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = \"http://connect.facebook.net/en_US/all.js#xfbml=1&appId=" + APP_KEY + "\";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-comments\" data-href=\""
+ mExternalUrl + "\" data-width=\"500\"></div> </body></html>");
But, in the web view i am getting an empty screen not able to get the facebook comments view. How to enable the script in web view in uwp. Please help me. Thanks.
But, in the web view i am getting an empty screen not able to get the facebook comments view. How to enable the script in web view in uwp.
The NavigateToStringmethod does not provide a way to generate or provide css, scripts, images, and fonts resources programmatically. You can refer to WebView.NavigateToString method.
You can transfer your string into HTML file, and use Navigate method to navigate to the HTML page. Just for example, create a HTMLPage file in the project and code for it, then in the c# code behind:
Uri uri = new Uri("ms-appx-web:///HTMLPage1.html");
FBCommentsTest.Navigate(uri);
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