Determine, the browser supports canvas (paperjs), or not

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

Upvotes: 1

Views: 198

Answers (2)

eivers88
eivers88

Reputation: 6247

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.

Upvotes: 2

Simon Sarris
Simon Sarris

Reputation: 63812

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

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

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

Upvotes: 1

Related Questions