M
M
Mikhail Stets2016-11-08 09:03:09
safari
Mikhail Stets, 2016-11-08 09:03:09

How can getContext('2d') of HTML5 Canvas return null in Safari 10.0(.1)?

We cannot reproduce the problem even on existing MacBooks with the latest stable Safari. However, an error was logged from users when trying to use the drawing methods of CanvasRenderingContext2D, because it is null.
From the researched:
- The Canvas itself is precisely created, has positive dimensions
- The getContext call occurs after the page is loaded (onload)
- There were no other calls to getContext with other parameters (for example, webgl)
- The getContext call always occurs with the string "2d" (in the lower case)
- Repeated exclusively under Safari 10 version with enviable frequency.
- In some cases, the crash did not occur immediately after the page was loaded, but after redrawing, i.e. the user has performed some action on the page.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question