Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading UIWebView TEXT content

I am interested in reading ONLY the TEXT content of a UIWebView. How do I do this? I found lots of help on the web about reading the HTML content but I want ONLY the Text. Any suggestions?

Thanks

like image 518
Sharief Avatar asked Dec 18 '22 01:12

Sharief


1 Answers

Get the .textContent or .innerText of the root node, instead of .innerHTML.

[web stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerText;"];

(BTW, there is also a private property webView.text.)

like image 113
kennytm Avatar answered Jan 03 '23 01:01

kennytm