There is no easy way. Regex HTML with RegexKitLite ( http://regexkit.sourceforge.net/RegexKitLite/index.html ) and hook all the URLs .jpg, .gif, .png and .css and. js and all you need.
alternately call:
NSString* imgUrls=[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')"]
or something like that, I'm not javascript whiz ... and then figure out what is coming back;)
Unfortunately. This is a pain in the rear.
edit:
Save all img to iphone, also save html file. When you want to reload the page, load the html from the file to a line and then use
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL
to load an HTML string. baseURL is used to indicate the directory or site on which the web view will represent that the html string you are passing is located. All URLs will apply to this.
Please note, of course, that this will not work very well for absolute URLs, only for relative ones. Thus, in your html file there will be monkeys:
<img src="http://google.com/f/r/i/g/img.gif">
until this is ok:
<img src="f/r/i/g/img.gif">
Again, this whole solution is dirty. You can take a peek at the pre-existing open source recursive html spider. I think wget does what you want, but I doubt that it can be compiled for the iPhone without any problems.
Kenny winker
source share