javascript - Embed D3.js with iframe -


i'm trying create iframe javascript , embed d3 in iframe.like this

    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');     iframe.src = 'data:text/html;charset=utf-8,' + encodeuri(idiv);     document.body.appendchild(iframe);     console.log('iframe.contentwindow =', iframe.contentwindow);     target.appendchild(iframe); 

but couldn't do. kindly me.

ok... way

iframe.src = 'data:text/html;charset=utf-8,' + encodeuri(idiv.outerhtml); 

fiddel : http://jsfiddle.net/cyril123/8xr8ub8s/1/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -