Browse Source

Quick fix for Detector that got broken with latest Chrome canary.

For some reason Chrome canary 12.0.713.0 doesn't have "window.WebGLRenderingContext".
alteredq 14 years ago
parent
commit
633276ddd8
1 changed files with 11 additions and 1 deletions
  1. 11 1
      examples/js/Detector.js

+ 11 - 1
examples/js/Detector.js

@@ -7,7 +7,7 @@ Detector = {
 	// supported features
 
 	canvas	: !!window.CanvasRenderingContext2D,
-	webgl	: !!window.WebGLRenderingContext,
+	webgl	: detectWebGL(),
 	workers : !!window.Worker,
 	fileapi : window.File && window.FileReader && window.FileList && window.Blob,
 	
@@ -59,5 +59,15 @@ Detector = {
 		return message;
 
 	}
+	
 
 };
+
+function detectWebGL() {
+	
+	var c = document.createElement( "canvas" ),
+	webGLContext = c.getContext("experimental-webgl");
+	
+	return window.WebGLRenderingContext || webGLContext;
+	
+}