title: HTML5 - Canvas available contexts
body: <p>How can I get a list of the available contexts on a given canvas? Unfortunately, using getContext on every possible option would not work since <a href="https://stackoverflow.com/a/13406681/2054629">https://stackoverflow.com/a/13406681/2054629</a>
  So</p>
  
  <pre><code>var possibleContexts = ['2d', 'webgl', 'webgl2', 'experimental-webgl', 'experimental-webgl2', ...];
  var availableContexts = possibleContexts.filter(function(c) { return canvas.getContext(c); });
  </code></pre>
  
  <p>won't work</p>
  
  <p>I'm trying to get a better understanding while at some point in my code webgl context is available and sometime not. I have users for who a newly created canvas will have a webgl context and the one I'm interested in fails. I'm trying to better understand that. So solutions that would create new canvas won't work here...</p>
  
  <p>At the moment I'm doing things like:</p>
  
  <pre><code>var testWebGl = function() {
    var canvas = document.createElement('canvas');
    return !!(canvas.getContext('webgl') || canvas.getContext('canvas.getContext('webgl')');
  };
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>if (testWebGl())
    doSomeWebGlStuff(myCanvas);
  </code></pre>
  
  <p>And occasionally <code>doSomeWebGlStuff</code> will fails because I can't get a webgl context on <code>myCanvas</code>. So I'd like to get all the available contexts on the exact canvas I'm interested in.</p>