如何与QUOT;呈现" HTML没有WebBrowser控件 [英] How to "render" HTML without WebBrowser control

查看:188
本文介绍了如何与QUOT;呈现" HTML没有WebBrowser控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,在所有 - 我不知道,如果渲染是正确的字。我喜欢从网站上获取信息。目前,所以我用WebBbrowser控制。 现在,我喜欢用HttpWebRequests,因为我认为,这是速度更快,线程可以更方便地使用。但我不能使用它们,因为我从HttpWebRequest的接收HTML的输出字符串已经得到了大量的JavaScript内从该信息,即我需要的,将被创建。 Web浏览器渲染的JavaScript以可读的HTML。如何做到这一步手动,这样我就可以使用HttpWebRequests?

First at all - I don't know if "render" is the right word. I like to get information from an website. At the moment therefore I use the WebBbrowser control. Now I like to use HttpWebRequests because I think, that's much faster and threading could be used more easily. But I can't use them, because the HTML-output string I receive from HttpWebRequest has got a lot of JavaScript inside from which the information, that I need, will be created. The web browser "renders" the JavaScript to readable HTML. How to do this step "by hand", so that I can use HttpWebRequests?

我希望你明白,我想要什么。

I hope you understand, what I want.

推荐答案

我解决我的问题与项目名为 Awesomium 。在此线程你会发现所有你需要得到的HTML与JavaScript的执行。 特殊的一部分是这个:

I solved my problem with a project called Awesomium. In this thread you will find all you need to get html with executed javascript. The "special part" is this one:

var sourceVal = webView.ExecuteJavascriptWithResult( "document.getElementsByTagName('html')[0].outerHTML;" );

if ( sourceVal != null )
{
    using ( sourceVal )
    {
        html = sourceVal.ToString();
    }
}

这篇关于如何与QUOT;呈现" HTML没有WebBrowser控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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