I've seen all of the posts explaining how to save an HTML5 canvas screenshot as an image and opening that image in a new tab. However, I was hoping to take that screenshot and have the image appear in an already-allocated div on the SAME WEBPAGE after the screenshot is taken. Any ideas? Thank you!
Asked
Active
Viewed 341 times
-1
-
duplication to this http://stackoverflow.com/questions/923885/capture-html-canvas-as-gif-jpg-png-pdf – tinker Nov 22 '14 at 19:46
-
@sking this is not a duplicate question. I looked at that post previously. I am looking for a way to take that newly generated url and append it to my HTML to appear under my canvas. – es270 Nov 22 '14 at 20:32
1 Answers
0
<canvas id="mycanvas"></canvas>
<div id="under_canvas"></div>
<script>
var canvas = document.getElementById('mycanvas');
var img = canvas.toDataURL("image/png");
//dataURL can directly be inserted into src of image
document.getElementById('under_canvas').innerHTML = '<img src="'+img+'"/>';
</script>

tinker
- 855
- 1
- 6
- 13