Skip to content

Detecting WebGL and browser compatibility with three.js

ubershmekel edited this page Nov 30, 2011 · 2 revisions

The problem

Not all browsers support WebGL, in fact only chrome and firefox work with three.js currently. In order to detect the problem and gracefully inform the user you can add https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js to your javascript and use this example to avoid even attempting to render anything.

if (Detector.webgl) {
	init();
	animate();
} else {
	var warning = Detector.getWebGLErrorMessage();
	document.getElementById('container').appendChild(warning);
}