title: HTML/jQuery onload/load not getting executed on iOS
body: <p>I am trying to show SVGs on an iPhone/iPad. This code is running in an ASP.Net page. I am using Raphael to display the graphics and all of the other jazz that Raphael handles. However, I have code that does not actually execute on iOS.</p>
  
  <pre><code> img = new Image();
  
   //img.onload = function () { drawLayersWhenAllAreLoaded(); };
   if (img.addEventListener) {
       img.addEventListener('load', drawLayersWhenAllAreLoaded, false);
   }
   else {
       img.attachEvent("onload", function () { return (drawLayersWhenAllAreLoaded.call(img, window.event)); });
   }
  
   img.src = files[i];
  </code></pre>
  
  <p>I've tested this in Chrome, Firefox, and Safari on Windows and it works great. I've tested this in Chrome, Firefox, and Safari on Mac OS X and it works great. However, when running on iOS(doesn't matter if iOS 6 or iOS 7, doesn't matter iPhone or iPad), the <code>drawLayersWhenAllAreLoaded</code> function does not get executed. If it doesn't get executed, the images don't show on the screen.</p>
  
  <p>This is the final code I tested. I've tested not checking for iOS. I've tested using just <code>img.onload</code>. I've tried just using <code>img.addEventListener</code>. If tried every version of this code from the simplest to the most complex, and I can't get it to work at all. If I put an alert in the <code>drawLayersWhenAllAreLoaded</code>, it shows on all browsers above, but does not show on iOS.</p>
  
  <p>From my understanding, setting the <code>src</code> of an Image in HTML/jQuery will load the image. Our images can be fairly large, so I need to wait for them all to load before calling <code>drawLayersWhenAllAreLoaded</code>(this code is in a loop loading a bunch of images).</p>
  
  <p>I've searched Google for hours looking for something similar and was unable to find anything. Wondering if anybody has run into this again, or see what I am doing wrong?</p>
  
  <p>Thanks.</p>
  
  <p><em>EDITED</em>:</p>
  
  <p>After more testing, I've determined that my <code>drawLayersWhenAllAreLoaded</code> does get hit, but only once. I'm currently trying to load 32 images. The code to load the images does run 32 times on iOS(adding an alert shows each time), but the <code>drawLayersWhenAllAreLoaded</code> is only called once.</p>