Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (54 sloc) 2.11 KB
<html>
<head>
<title>Test for WebGL</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
var gl;
function browserSupportsWebGL() {
if (window.WebGLRenderingContext === undefined) {
return false
} else {
return true
}
}
function webglContextCreationErrorHandler(evt) {
if (evt.statusMessage) {
document.getElementById("status-message").textContent = evt.statusMessage;
}
};
function webGLTest() {
var canvas = document.getElementById("canvas");
var results = document.getElementById("results");
canvas.addEventListener("webglcontextcreationerror", webglContextCreationErrorHandler, false);
try {
gl = canvas.getContext("experimental-webgl");
} catch(e) {
}
var result = "";
if (!gl && browserSupportsWebGL()) {
result = "Your browser supports WebGL but there was an error starting up. This may mean you need to update your video drivers. Try: <a href='http://get.webgl.org/troubleshooting'>http://get.webgl.org/troubleshooting</a>";
} else if (!gl) {
result = "Your browser does not support WebGL. Try: <a href='http://get.webgl.org'>http://get.webgl.org</a>";
} else {
result = "Your browser supports WebGL";
};
results.innerHTML = result;
}
</script>
<body onload="webGLTest();">
<h3>Test Browser for WebGL Capability</h3>
<h4>Results</h4>
<p id="results"></p>
<h4>Browser-specific status message</h4>
<p id="status-message"></p>
<h4>Test input element for Chrome 10 bug (versions older than 10.0.648.204)</h4>
<p>Chrome bug: <a href="http://code.google.com/p/chromium/issues/detail?id=71624">experimental-webgl" breaks page on chrome 10</a></p>
<form id="form1">
<label id="label1" for="input1">Enter text: </label>
<input type="text" id="input1" name="input1" />
<input type="submit" value="Submit" />
</form>
<p>On Chrome 10 versions older than 10.0.648.204 on Windows you will not see text you enter into the input field.</p>
<canvas id="canvas" style="border: none;" width="100" height="100"></canvas>
</body>
</html>
Something went wrong with that request. Please try again.