Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Data from UIWebView

Tags:

iphone

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.

like image 399
Matrix Avatar asked Jun 08 '10 08:06

Matrix


1 Answers

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"];
like image 179
adam Avatar answered Oct 13 '22 23:10

adam