Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all text which is on screen in UIWebView

I need to get all words, which are visible on screen from UIWebView. My UIWebView have html content.

Someone can help me please.

like image 723
Romit M. Avatar asked May 08 '12 12:05

Romit M.


2 Answers

Use following way that will give you all text of UIWebView.

NSString *yourstring = [webView stringByEvaluatingJavaScriptFromString: 
                  @"document.body.innerText"];

Hope, this will help you...

like image 148
Nitin Avatar answered Nov 04 '22 18:11

Nitin


you can use

NSString *str = [self.youWebView stringByEvaluatingJavaScriptFromString:
                                  @"document.body.textContent"];
like image 5
adali Avatar answered Nov 04 '22 18:11

adali