How do I use a canvas inside a sandboxed iframe from the parent and from the same origin. For example:
HTML:
<iframe id="myIframe" sandbox="allow-forms allow-same-origin" srcDoc='<canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;display: block"></canvas>'
JS:
var iframeDocument = document.getElementById("myIframe").contentDocument
var c = iframeDocument.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(200,100);
ctx.stroke();
The above code would just not work but the the code works on a regular canvas not inside a iframe.