开发者

help with reading text body from a web page

NSString *myText = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerText"]; NSLog(@"my text -> %@",my开发者_C百科Text);

I get all the JavaScript for the webView but what i want is to save the body text only from the web page so can any body help me with some codes or any ideas thanks


Take the innerText of some element in the document, i.e. from body element.


It sounds like you want to get the text of the document excluding the tags.

If the page you're visiting uses JQuery, you could simply use $(body).text() to achieve this.

If not, you may need to strip off the tags with a regular expression yourself. This post seems to have an answer for this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜