浏览器控件NavigateToString显示HTML代码,而不是渲染页面 [英] Browser control NavigateToString display HTML code instead of rendering page

查看:687
本文介绍了浏览器控件NavigateToString显示HTML代码,而不是渲染页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发采用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。<一个问题/ p>

在这里你有一个解决方法。


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代码,而不是渲染页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆