[Public WebGL] How to check for WebGL support

Glenn Maynard [email protected]
Thu May 19 11:27:55 PDT 2011

On Thu, May 19, 2011 at 1:37 PM, Vangelis Kokkevis <[email protected]>wrote:
> One possible solution would be to define window.WebGLRenderingContext only
> if both the browser supports WebGL and all the blacklist / user-pref / etc.
>  tests succeed.

A problem someone pointed out at one point is that browsers (Chrome, as I
recall) want to be able to update the GPU blacklist at runtime while the
browser is running, without forcing a browser restart.  However, once you
expose WebGLRenderingContext to a window, you can't remove it.

I think there's nothing wrong with browsers not exposing WebGL interfaces
when it's known in advance that WebGL isn't available, but pages still
couldn't depend on it.  They'd still end up having to create a context to
check whether it actually works.

On Thu, May 19, 2011 at 2:21 PM, Gregg Tavares (wrk) <[email protected]>
> I guess I don't understand the use case.
> Either you want to use WebGL in which case you are going to have to call
canvas.getContext("webgl") with whatever parameters your app needs and see
if it succeeds.  You have to pay the startup cost since you are using WebGL.
> If it fails (blacklisted, no webgl) there is no startup cost or shouldn't
> Why do you need another way to check?

You may want to grey out or remove WebGL-related features from your site if
it's known in advance that it's not going to work, instead of presenting the
user with unusable features.  Not every use of WebGL is something that's
started up immediately when a page loads.

Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110519/1c7e0798/attachment.html>

More information about the public_webgl mailing list