Even though this is becoming less and less of a problem, some devices or browsers may still not support WebGL. The following method allows you to check if it is supported and display a message to the user if it is not.
Run the following before attempting to render anything.
if (v3d.Detector.checkWebGL()) {
// Initiate function or other initializations here
animate();
} else {
var err = Detector.genWebGLErrorMessage();
document.getElementById('container').appendChild(err);
}