Question

Please tell, how can i determine, the browser supports canvas (paperjs), or not ?

Was it helpful?

Solution

var canvasExists = document.createElement('canvas').getContext !== undefined;

Will be true in Chrome, false in IE8, etc.

You could also check for window.HTMLCanvasElement !== undefined

OTHER TIPS

I recommend using Modernizr for html5 canvas support detection. With Modernizr, it is as simple as

if(Modernizr.canvas) {
    //HTML5 canvas action
}

for reliable and consistent detection across all browsers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top