JSFiddle - React, Tailwind, and code Playground

by abdennour

HTML

<script src="https://rawgit.com/niklasvh/html2canvas/master/dist/html2canvas.min.js"></script>

JavaScript

var iframe=document.createElement('iframe');
$('body').append($(iframe));
setTimeout(function(){
    var iframedoc=iframe.contentDocument||iframe.contentWindow.document;
    $('body',$(iframedoc)).html('<html><head></head><body><p>I am iframe with canavas</p></body></html>');
    html2canvas(iframedoc.body, {
        onrendered: function(canvas) {
            $('body',$(document)).append(canvas);
            $('body',$(document)).remove(iframe);
        }
    });
}, 10);