Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Canvas inside of iframe cannot be used from parent

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.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!