title: How to get all <img src> of a web page in iOS UIWebView?
body: <p>everyone.</p>
  
  <p>I'm trying to get all image urls of the current page in UIWebView.</p>
  
  <p>So, here is my code.</p>
  
  <pre><code>- (void)webViewDidFinishLoad:(UIWebView*)webView {
      NSString *firstImageUrl = [self.webView stringByEvaluatingJavaScriptFromString:@"var images = document.getElementsByTagName('img');images[0].src.toString();"];
      NSString *imageUrls = [self.webView stringByEvaluatingJavaScriptFromString:@"var images= document.getElementsByTagName('img');var imageUrls = "";for(var i = 0; i &lt; images.length; i++){var image = images[i];imageUrls += image.src;imageUrls += \\’,\\’;}imageUrls.toString();"];
      NSLog(@"firstUrl : %@", firstImageUrl);
      NSLog(@"images : %@",imageUrls);
  }
  </code></pre>
  
  <p>1st NSLog returns correct image's src, but 2nd NSLog returns nothing.</p>
  
  <pre><code>2013-01-25 00:51:23.253 WebDemo[3416:907] firstUrl: https://www.paypalobjects.com/en_US/i/scr/pixel.gif
  2013-01-25 00:51:23.254 WebDemo[3416:907] images :
  </code></pre>
  
  <p>I don't know why.
  Please help me...</p>
  
  <p>Thanks.</p>