+ 1
JavaScript errors
how do you deal with JavaScript errors such as "Cannot read property of null" when using methods such as getContext('2d'), window. innerHeight/Width ?
1 Resposta
+ 4
Wait for the document to load before getting the canvas. So something like this:
onload = function() {
canvas = document.getElementById('myCanvas');
ctx = canvas.getContext('2d');
.....
...
}