Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 442331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:03:41+00:00 2026-05-12T21:03:41+00:00

In my app there’s a uiwebview that loads a URL. I am using the

  • 0

In my app there’s a uiwebview that loads a URL.
I am using the following line to save the HTML of the page loaded locally to be able to view it offline:

NSString* html=[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].innerHTML"]

The problem is that only the HTML of the document gets saved. I want to save also the images and the CSS along with the HTML so that the user see the page as if they are online.

Just like "save web page complete" or something like that, that we’re used to in the browsers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:03:41+00:00Added an answer on May 12, 2026 at 9:03 pm

    There is no easy way. Regex the HTML using RegexKitLite (http://regexkit.sourceforge.net/RegexKitLite/index.html) and snag all the urls to .jpg,.gif,.png, and .css and .js and whatever all else you need.

    alternately, call:

    NSString* imgUrls=[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')"]
    

    or something like that, I’m no javascript whizz… and then deal with whatever all that returns 😉

    Sorry. It’s a pain in the rearheinie.

    edit:

    Save all the img’s on the iphone, also save the html file. When you want to reload the page, load the html from a file into a string, and then use

    - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
    

    to load the HTML string. baseURL is used to specify the directory or site the webview will imagine the html string you hand it is located. All URLS will be relative to that.

    Note, of course that this will not work very well for absolute URLs, only for relative ones. So this, in your html file, will monkey things up:

    <img src="http://google.com/f/r/i/g/img.gif">
    

    while this would be ok:

    <img src="f/r/i/g/img.gif">
    

    Again, this whole solution is mucky.
    You might look into a pre-existing open source recursive html spider. I think wget does what you want, but I doubt it can be compiled for iPhone without a -lot- of hassle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my GAE app there is the following line : ContactsService myService=new ContactsService(app-name); It
For a page in our app there is a certain number of customers that
In my app there is requirement that..I have 6 buttons in a nib, when
I'm coding an app that works much like Apple's Weather.app: There's a UIPageControl at
I have an iPhone app out there that calls home to my server every
I have a background that i put in my app and there are places
for my app if there is one white space that is fine. But if
In my flex app there's an item renderer for a TileList that I am
On every windows app there is that context menu that you can access with
I have following question. In my app there is a listview. I get itemname

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.