Detecting browsers that support GoJS

Do you have a recommended method to detect if a browser will support GoJS? Maybe you have some simple detection in your framework that you can share. There is also Modernizr which we could use and I’m assuming we need to check for Canvas and Canvas Text.

GoJS currently uses:
document.createElement(‘canvas’).getContext !== undefined

I was hoping simple would be good enough! Does GoJS use Canvas Text? If so I’ll add a simple check for that also.

I’m not sure what you mean. Canvas includes drawing text as well as images and shapes.

Looks like canvas text was added after the canvas API.

Modernizr also has a separate check for it:

I’m assuming your text blocks use it but thought I better check.

That API was added because the original canvas API from Apple did not support drawing text at all. So, that web site contains obsolete information.

I suppose I should put in a plug for Simon’s book: HTML5 Unleashed.