I Created a WebPart which draws a Dashboard using canvas.js,but sometimes when I refresh the page,nothing displays.This only happens in IE.
When I debug it,it points to these codes:
var ctxBg = document.getElementById(backgroundId).getContext("2d");
It says ” Object doesn’t support property or method ‘getContext’ “.
How can I handle it?
If it only happens “sometimes”, that could indicate that your code is executing before your canvas element has loaded. I won’t get into IE support for canvas, or working with SharePoint’s nuances, but it seems like a good place to start is making sure that your entire page has loaded before executing your canvas method.