Alex Rivera | Logout

Reading HTML content from a UIWebView

Asked 2009-06-14T07:17:15.097
134

Is it possible to read the raw HTML content of a web page that has been loaded into a UIWebView?

If not, is there another way to pull raw HTML content from a web page in the iPhone SDK (such as an equivalent of the .NET WebClient::openRead)?

Edit
Report

1 Answer

44

To get the whole HTML raw data (with <head> and <body>):

NSString *html = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];
answered 2012-04-16T17:46:32.950

Your Answer