Sharief
Sharief

Reputation: 1485

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

Upvotes: 4

Views: 5204

Answers (1)

kennytm
kennytm

Reputation: 523274

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.)

Upvotes: 12

Related Questions