PDA

View Full Version : How to access HTML source in an iphone App?




lasher316
Dec 9, 2008, 12:18 AM
How do I get the HTML source of a webpage using uiWebView? Is this
even possible? Sometimes I may want to show only some of the
content of certain webpages so as not too cluttered. So I would just
parse the HTML and get the info needed.

Do I use uiwebview or is their another method I can use>

Thanks.



SqueegyX
Dec 9, 2008, 01:15 AM
I'm not sure if this is best way, but its one way. Let your app be a proxy. When you need to fetch a URL, manually download the HTML with an http request. Then process the result, and feed raw HTML in a uiwebview.

That should give the flexibility you need to achieve this.

ghayenga
Dec 9, 2008, 06:52 PM
I'm not sure if this is best way, but its one way. Let your app be a proxy. When you need to fetch a URL, manually download the HTML with an http request. Then process the result, and feed raw HTML in a uiwebview.

That should give the flexibility you need to achieve this.

Your other option would be to put a javascript function that returns the text of the page and call it from your code using the stringByEvaluatingJavascript method of the UIWebView.