title: jQuery, dynamically download image: IE doesn't know its width and its height
body: <p>Here my code in my <code>head</code> section:</p>
  
  <pre><code>   &lt;script src="jquery-1.10.1.min.js"&gt;&lt;/script&gt;
     &lt;script src="metro.js"&gt;&lt;/script&gt;
     &lt;script src="draw.js"&gt;&lt;/script&gt;
     &lt;script&gt;
         $(document).ready(function() {
             var im = $('&lt;img /&gt;')
                 .attr({id: 'metro', src:'metro.png'})
                 .appendTo($('body'))
                 .hide()
                 .on('load', function() {
                     okIm = true;
                     drawIfOk();
                 });
             var bg = $('&lt;img /&gt;')
                 .attr({id: 'back', src:'back.png'})
                 .appendTo($('body'))
                 .hide()
                 .on('load', function() {
                     okBg = true;
                     drawIfOk();
                 });
         });
     &lt;/script&gt;
  </code></pre>
  
  <p>This code should download dynamically 2 images and in the <code>drawIfOk();</code> function, i test if both images are downloaded. If so, then I try to create canvas based on the width &amp; height of the image, like this:</p>
  
  <pre><code>function drawIfOk() {
      if (!okIm) {
          return;
      }
      if (!okBg) {
          return;
      }
  
      initTest();
  }
  </code></pre>
  
  <p>Simple eh?</p>
  
  <p>Now the <code>initTest();</code> function is very simple:</p>
  
  <pre><code>function initTest() {
      gImgMetro = $('#metro')[0];
      var bg = $('#back')[0];
  
      /* Création du canvas */
      gImgCanvas = $('&lt;canvas /&gt;').attr({
          width: bg.width,
          height: bg.height
      })[0];
      gImgCtx = gImgCanvas.getContext('2d');
      if(!gImgCtx) {
          displayError("Impossible de récupérer le context du canvas");
          return;
      }
  }
  </code></pre>
  
  <p>Then IE gives me an error because <code>bg.width</code> and <code>bg.height</code> are 0 whereas it works on Safari, Chrome, Firefox and Maxthon! [Trying not to grumble about IE]</p>
  
  <p>How to circumvent this?</p>