Reading data from a UIWebView

How to read UIWebView data. I want to read "View URL Source" in a UIWebView. anyone have an idea let me know.

Thanks.

+7
iphone
source share
1 answer

You have to do

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

However, if you decide to use UIWebView to retrieve the HTML, you can try

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

or

 NSString *html = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]; 
+18
source share

All Articles