WebGL is detected as being supported when it is not actually

I am using WebGL from WebView on Android. To determine support for WebGL or not, I use this function .

Android KitKat devices do not have WebGL support, as mentioned throughout. However, in my test device 4.4.2, the discovery function returns true, and when calling http://webglreport.com from WebView, it also says that WebGL1 is supported.

No wonder nothing happens. Therefore, I would like to avoid using the version of WebGL on the page if WebGL does not work.

Is there any way better to detect webGL? Or should I just say "if Android <5, don’t even try to check if WebGL is supported, as it may be."

0
javascript android android-webview android-4.4-kitkat webgl
Dec 06 '16 at 23:08
source share
2 answers

I had a similar experience with Android devices. Solved by the blacklist of the Android browser (and, if I understand correctly, browsing the web as well). Updated Chrome usually works fine.

+1
Dec 07 '16 at 9:08
source share

In response to @ kirill-dmitrenko’s answer, but avoiding parsing user agents, I blacklisted all browsers that don’t support the let construct ( http://caniuse.com/#feat=let ), which, although unrelated seems to be supported by all modern browsers supporting webgl:

var supported; try { var canvas = document.createElement('canvas'); supported = !! window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')); } catch(e) { supported = false; } try { // let is by no means required, but will help us rule out some old browsers: http://caniuse.com/#feat=let eval('let foo = 123;'); } catch (e) { supported = false; } if (supported === false) { console.log("WebGL is not supported"); } 
0
Dec 07 '16 at 23:34
source share



All Articles