问题描述
我正在开发采用Windows Phone 8浏览器控制浏览器的应用程序。
该应用程序下载使用WebClient的外部网页到后台的字符串。然后浏览器中使用
webBrowser.NavigateToString(STR)导航到的内容;
然而,代替呈现网页时,浏览器显示的HTML代码。我想既然没有变化,以串制成, NavigateToString
应该无缝地处理它。也许我失去了一些东西。
那么,如何显示HTML网页,而不是它的代码?
修改
下面是一些我的代码
WebClient的=新的WebClient();
webClient.DownloadStringCompleted + =新DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
webClient.DownloadStringAsync(新的URI(URI));
私人无效webClient_DownloadStringCompleted(对象发件人,DownloadStringCompletedEventArgs E)
{
PageString = e.Result;
}
...
webBrowser.NavigateToString(PageString);
这是随着Windows Phone 8。
的你有一个解决方法。
I am developing a browser app using Windows Phone 8 browser control.
The app download an external webpage using WebClient into a string in the background. Then the browser navigate to the content using
webBrowser.NavigateToString(str);
However, instead of rendering the page, the browser shows the HTML code. I thought since no changes were made to the string, NavigateToString
should handle it seamlessly. Or perhaps I am missing something.
So how do I display the HTML page instead of its code?
EDIT
Here's some of my code
webClient = new WebClient();
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadStringCompleted);
webClient.DownloadStringAsync(new Uri(uri));
private void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
PageString = e.Result;
}
...
webBrowser.NavigateToString(PageString);
This is an issue with Windows Phone 8.
Here you have a workaround.
这篇关于浏览器控件NavigateToString显示HTML代码,而不是渲染页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!