if(/MSIE (\d+\.\d+); /.test(navigator.userAgent)) {
var foo = document.getElementById('herd-reports-report-table-div');
var c = document.createElement('canvas');
c.setAttribute("width",800);
c.setAttribute("height",400);
c.setAttribute("class","mapping");
foo.appendChild(c);
c = G_vmlCanvasManager.initElement(c);
} else {
var c = document.getElementById('herd-report-chart-canvas');
}
var context = c.getContext('2d');
Let's say that I have this code executing in a function on load of a page, and I need a chart to be built. I have included excanvas, yet it won't work. IE8 throws an error at the last line. All I get is "null" error at the appendChild step. Or i get "Object is not supported by this property or method".
I'm at my wit's end. I need this canvas to work in IE8. Somehow.
So I ultimately found the fix for why it (getContext) wasn't working. A few things