WebGL-compatibility-check.html 915 B

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p>
  12. Even though this is becoming less and less of a problem, some devices or browsers may still not support WebGL.
  13. The following method allows you to check if it is supported and display a message to the user if it is not.
  14. </p>
  15. <p>
  16. Add [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/WebGL.js]
  17. to your javascript and run the following before attempting to render anything.
  18. </p>
  19. <code>
  20. if ( WEBGL.isWebGLAvailable() ) {
  21. // Initiate function or other initializations here
  22. animate();
  23. } else {
  24. const warning = WEBGL.getWebGLErrorMessage();
  25. document.getElementById( 'container' ).appendChild( warning );
  26. }
  27. </code>
  28. </body>
  29. </html>