Detect html canvas support with javascript

by Adi Jaya

HTML

<canvas id="demo"></canvas>

JavaScript

var selector = document.getElementById( "demo" );

if( selector ){

	if( selector.getContext ){
    	alert( "support" );
    } else {
    	alert( "not support" );
    }
    
} else {
	console.log( "Element ID not found" );
}