JSFiddle - React, Tailwind, and code Playground
by Cyril Cherian
HTML
<title>Insert title here</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<body>
<div id="pp12"> </div>
</body>
JavaScript
(function () {
generateD3 = function () {
var iDiv = document.createElement('div');
iDiv.id = 'block';
document.getElementsByTagName('body')[0].appendChild(iDiv);
var target = document.getElementById("pp12");
var container=d3.select("#block").append("svg")
.attr("width", 200)
.attr("height", 200)
.style("border", "1px solid black");
var iframe = document.createElement('iframe');
console.log(encodeURI(iDiv.outerHTML));
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(iDiv.outerHTML);
document.body.appendChild(iframe);
console.log('iframe.contentWindow =', iframe.contentWindow);
target.appendChild(iframe);
};
generateD3();
})
();