How to access HTML source in an iphone App?

Discussion in 'iOS Programming' started by lasher316, Dec 8, 2008.

  1. lasher316 macrumors newbie

    Dec 8, 2008
    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>

  2. SqueegyX macrumors regular

    Mar 24, 2008
    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.
  3. ghayenga macrumors regular

    Jun 18, 2008
    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.

Share This Page