tags:

views:

83

answers:

1

Hi,

How to read UIWebView Data. i want to read View Source of the url in the UIWebView. anybody has any idea then let me know.

Thank you.

+2  A: 

You should do

NSString *html = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"www.apple.com"]];

However if you're determined to use the UIWebView to get the HTML, you can try

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

or

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