UIWebView获取HTML源代码 [英] UIWebView get HTML Source
问题描述
我正在尝试获取UIWebView的HTML源代码,而无需再次重新下载它(也可以进行其他下载,例如 [NSData dataWithContentsOfURL:(NSURL *)URL]
或启动一个NSURLRequest浏览UIWebView头文件,似乎没有办法访问当前加载的NSData的源代码,我错过了什么?
I am trying to get the HTML source of a UIWebView without re-downloading it again (a.k.a. do another download, such as [NSData dataWithContentsOfURL:(NSURL*)URL]
or launching an NSURLRequest. Browsing the UIWebView header and documentation, there seems to be no way of accessing the current loaded NSData of the source. Am I missing something ?
推荐答案
逆需要做你想做的事情,也就是将URL加载到NSData对象中,然后使用 - loadData:MIMEType:textEncodingName:baseURL从该对象加载UIWebView :
The inverse should do what you want. That is, load the URL into an NSData object and then load the UIWebView from that object using – loadData:MIMEType:textEncodingName:baseURL:
这篇关于UIWebView获取HTML源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!