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

Is there a good Django app out there that can take a list of
Is there an app that can change the order of images inside an icon?
Is there an app or way to browse a directory that requires different login
Is there a way that my .NET CF app running on a Windows CE
Is there a Java equivalent to .NET's App.Config? If not is there a standard
Is there a way to scale a silverlight app to 100% width and 100%
Is there a way to make an Adobe AIR app fit screen(maximize) by itself
Is there any way to capture the trace statements of your Flex app while
Is there any way we can convert text to speech in an iPhone app?
Is there any way to Write files to App_Data under medium trust hack? Im

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.