javascript - Append a whole page to an iframe -


i append whole page (with <html><head> , <body> elements) inside existent empty iframe.

is possible @ all?

as far i've seen append content child element in iframe, such body:

$('#demo').contents().find('body').html('aaa'); 

but i'm trying append whole page, styles, head , on, need append document level. this:

//not working $('#demo').contents().html('<html><body>aaaa</body></html>'); 

you use document write() method, this:

var iframedoc = $('iframe')[0].contentdocument; // jquery example of course iframedoc.write(data); 

where data full valid page source string, including doctype, head, etc...

-demo-


Comments