【问题标题】:get whole html source of webpage with c# or get data of jquery code with c#使用 c# 获取网页的整个 html 源代码或使用 c# 获取 jquery 代码的数据
【发布时间】:2017-06-18 21:58:08
【问题描述】:

根据reply,我们只能看到服务器发送给浏览器的HTML代码。

“查看源代码”仅显示在浏览器向服务器请求特定网页时服务器发送的源代码。因此,由于这些更改是在客户端进行的,因此它们不会显示在“查看源代码”中,因为它们是在原始页面交付后进行的。要查看页面的实时源代码,您可以使用webkit 浏览器中的 Web Inspector 视图,或 Firefox 中的 Firebug。它们会跟踪对 DOM 的任何更改并更新您可以看到的源代码。

即使在客户端完成后,我如何在 C# 中获取整个 HTML 代码。 我可以通过 Webclient 获取 HTML。

也许我应该像 C# 中的 borwsers 一样工作。但是怎么做?


更新

<script id="frmJqrTplCommentItem" type="text/x-jquery-tmpl">
{{each Comments}}
<li>
    <div class="user-comment-container" itemprop="review" itemscope itemtype="http://schema.org/Review">
        <div class="user-comment-header clearfix">
            <div class="user-info right clearfix {{if UserType === 1}}buyer{{else UserType === 2}}DK-expert{{/if}}">

                <h5>
                    {{if FullName === null || FullName === ''}}
                    <span itemprop="author">کاربر مهمان</span>
                    {{else}}
                    <span itemprop="author">${$value.FullName}</span>
                    {{/if}}
                    {{if UserType === 1}}
                    <span>(خریدار این محصول)</span>
                    {{/if}}

                    <meta itemprop="datePublished" content="${$value.EditDateTime}">
                    <time>${DkUtility.formatDate($value.EditDateTime, 1).FaNumber()}</time>
                </h5>
                {{if IsActive === null || IsActive === false || IsActive === 0}}
                <div class='undercheck'>نظر شما منتظر تایید مدیر می‌باشد </div>
                {{/if}}
            </div>....

例如上面的代码是网页内的 html 代码的一部分。 我知道这一方将在客户端执行。我可以访问 {Comments} 吗??

【问题讨论】:

    标签: c#-4.0 webclient view-source


    【解决方案1】:

    简答 - 你不能。评估包括所有客户端 HTML 更改在内的整个页面需要您开发一个完整的 Web 浏览器。

    【讨论】:

    • 好的,我更新了我的答案。我们可以访问 jquery 函数吗?或者类似的东西,事实上我需要数据
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-24
    • 1970-01-01
    相关资源
    最近更新 更多