<tfoot id='vESIJ'></tfoot>
  1. <small id='vESIJ'></small><noframes id='vESIJ'>

    <legend id='vESIJ'><style id='vESIJ'><dir id='vESIJ'><q id='vESIJ'></q></dir></style></legend>

        <bdo id='vESIJ'></bdo><ul id='vESIJ'></ul>

    1. <i id='vESIJ'><tr id='vESIJ'><dt id='vESIJ'><q id='vESIJ'><span id='vESIJ'><b id='vESIJ'><form id='vESIJ'><ins id='vESIJ'></ins><ul id='vESIJ'></ul><sub id='vESIJ'></sub></form><legend id='vESIJ'></legend><bdo id='vESIJ'><pre id='vESIJ'><center id='vESIJ'></center></pre></bdo></b><th id='vESIJ'></th></span></q></dt></tr></i><div id='vESIJ'><tfoot id='vESIJ'></tfoot><dl id='vESIJ'><fieldset id='vESIJ'></fieldset></dl></div>

      获取加载的 UIWebView 的 HTML 源代码

      Getting the HTML source code of a loaded UIWebView(获取加载的 UIWebView 的 HTML 源代码)
        <tbody id='blvcp'></tbody>

        <small id='blvcp'></small><noframes id='blvcp'>

          <bdo id='blvcp'></bdo><ul id='blvcp'></ul>

          • <tfoot id='blvcp'></tfoot>
            <legend id='blvcp'><style id='blvcp'><dir id='blvcp'><q id='blvcp'></q></dir></style></legend>
              <i id='blvcp'><tr id='blvcp'><dt id='blvcp'><q id='blvcp'><span id='blvcp'><b id='blvcp'><form id='blvcp'><ins id='blvcp'></ins><ul id='blvcp'></ul><sub id='blvcp'></sub></form><legend id='blvcp'></legend><bdo id='blvcp'><pre id='blvcp'><center id='blvcp'></center></pre></bdo></b><th id='blvcp'></th></span></q></dt></tr></i><div id='blvcp'><tfoot id='blvcp'></tfoot><dl id='blvcp'><fieldset id='blvcp'></fieldset></dl></div>

              1. 本文介绍了获取加载的 UIWebView 的 HTML 源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何获取 UIWebViewHTML 源代码并将其存储在 NSString 中?

                How can I get the HTML source code of a UIWebView and store it in NSString?

                推荐答案

                如果你想要一个已经加载好的webview的源代码,你可以这样获取:

                If you want the source code of an already loaded webview, you can get it like this:

                    NSString *yourHTMLSourceCodeString = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"];
                

                更新: 上述方法大部分时间都有效.但我最近遇到了一种情况,我需要所有代码源,而不仅仅是正文.

                Update: method above works most of the time. But I recently was in a situation where I needed all the code source, not just the body.

                这里有一个更好的方法:

                Here is a better way:

                    NSString *yourHTMLSourceCodeString = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];       
                

                (它不会重新加载 webview).

                (It won't reload the webview).

                这篇关于获取加载的 UIWebView 的 HTML 源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Getting an NSArray of a single attribute from an NSArray(从 NSArray 获取单个属性的 NSArray)
                MFMessageComposeViewController alloc returns nil(MFMessageComposeViewController alloc 返回 nil)
                How to add and get the values from .plist in iOS(如何在 iOS 中从 .plist 添加和获取值)
                Automatic iVars with @synthesize(使用 @synthesize 的自动 iVar)
                How to automatically delete oldest core data entries when reach 50 entry limit?(达到 50 个条目限制时如何自动删除最旧的核心数据条目?)
                Creating a gradient fill for text using [UIColor colorWithPatternImage:](使用 [UIColor colorWithPatternImage:] 为文本创建渐变填充)

                  <tbody id='4d33f'></tbody>
                <i id='4d33f'><tr id='4d33f'><dt id='4d33f'><q id='4d33f'><span id='4d33f'><b id='4d33f'><form id='4d33f'><ins id='4d33f'></ins><ul id='4d33f'></ul><sub id='4d33f'></sub></form><legend id='4d33f'></legend><bdo id='4d33f'><pre id='4d33f'><center id='4d33f'></center></pre></bdo></b><th id='4d33f'></th></span></q></dt></tr></i><div id='4d33f'><tfoot id='4d33f'></tfoot><dl id='4d33f'><fieldset id='4d33f'></fieldset></dl></div>
                <tfoot id='4d33f'></tfoot>
              2. <legend id='4d33f'><style id='4d33f'><dir id='4d33f'><q id='4d33f'></q></dir></style></legend>

                <small id='4d33f'></small><noframes id='4d33f'>

                  <bdo id='4d33f'></bdo><ul id='4d33f'></ul>