DASA
DASA

Reputation: 11

setContext of canvas is undeined

I want to set context of canvas1 to canvas2.
I saw here - https://developers.whatwg.org/the-canvas-element.html#dom-canvas-setcontext
that setContext() is supported but I get an error of undefined function in chrome.

      var canvas1 = document.getElementById("myCanvas1");
      var canvas2 = document.getElementById("myCanvas2");
      ctx1 = canvas1.getContext("webgl");
      var gl = canvas2.setContext(ctx1);

why it happened? how can I set context of canvas from another canvas's context?

Upvotes: 0

Views: 1064

Answers (1)

nicokant
nicokant

Reputation: 493

Currently this feature is not supported by any browser.

The whatwg documentation is about standards, but not all the standards are currently supported by browsers. I recommend you to check caniuse and MDN to verify the actual support.

Upvotes: 1

Related Questions