I\'ve tried this a few different ways, but I keep getting stuck with the same error. I\'ve loaded an image to canvas before, but since I updated Safari a few days ago, I\'m
When you do this:
window.onload = init();
the function init() will be executed immediately (what causes the error, because getContext() gets called too early, i.e. before the DOM is loaded), and the return value of init() will be stored to window.onload.
So you want to actually do this:
window.onload = init;
Note the missing ().