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 15 năm trước cách đây
mục cha
commit
633276ddd8
1 tập tin đã thay đổi với 11 bổ sung1 xóa
  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;
+	
+}

粤ICP备19079148号