The WebGLRenderingContext.isContextLost() method returns a Boolean indicating whether or not the WebGL context has been lost.



Return value

A Boolean. True if the context is lost, false otherwise.


For example, when checking for program linking success, you could also check if the context is not lost:


if (!gl.getProgramParameter(program, gl.LINK_STATUS) && !gl.isContextLost()) {
  var info = gl.getProgramInfoLog(program);
  console.log('Error linking program:\n' + info);


Specification Status Comment
WebGL 1.0
The definition of 'WebGLRenderingContext.isContextLost' in that specification.
Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
isContextLostChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8.1Samsung Internet Android Full support Yes


Full support  
Full support

See also

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, fscholz, nmve, teoli
Last updated by: mdnwebdocs-bot,