title: IE 8 Canvas using excanvas polyfill: no errors, but animation is not running on IE 8
body: <p>I have an animation using canvas that is working fine in Chrome. I am using the excanvas polyfill for IE 8 support. I attached excanvas using an IE conditional tag in the head, as per the <a href="https://code.google.com/p/explorercanvas/wiki/Instructions" rel="nofollow">excanvas instructions</a>. </p>
  
  <p><a href="http://mike-eng.com/sandbox/xmas-ecard/" rel="nofollow">Working page here</a> | <a href="https://github.com/mrengy/xmas-ecard" rel="nofollow">Full code on Github</a> </p>
  
  <p>The simplified HTML:</p>
  
  <pre><code>&lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;!--[if gte IE 9]&gt;&lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;&lt;![endif]--&gt;
      &lt;!--[if lt IE 9]&gt;&lt;meta http-equiv="X-UA-Compatible" content="IE=7" /&gt;&lt;![endif]--&gt;
  
      &lt;link rel="stylesheet" href="css/normalize.min.css"&gt;
      &lt;link rel="stylesheet" href="css/ecard.css"&gt;
  
      &lt;script src="js/vendor/modernizr-2.6.2.min.js"&gt;&lt;/script&gt;
      &lt;!--[if lt IE 9]&gt;&lt;script src="js/vendor/excanvas.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;canvas id="card" width="1000" height="750"&gt;&lt;/canvas&gt;
  
      &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;window.jQuery || document.write('&lt;script src="js/vendor/jquery-1.10.1.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt;
  
      &lt;script src="js/ecard.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I am defining ctx using a ternary operator as recommended by the answer</p>
  
  <pre><code>var canvas = (typeof(G_vmlCanvasManager) != 'undefined') ? G_vmlCanvasManager.initElement($("canvas#card")[0]) : $("canvas#card")[0];
      ctx = canvas.getContext('2d');
  </code></pre>
  
  <p>When I try to run the animation from IE 8, it does nothing. I see no errors in IE 8 Developer Tools. However, when I type <code>ctx.fillRect(25, 25, 100, 100);</code> in the IE 8 Developer Tools console and run it, I get the error " 'ctx' is undefined".</p>
  
  <p>From IE 8 developer tools, it seems that excanvas.js is loaded properly. Any ideas?</p>