Reputation: 413
What I meant is that I am using this piece of code:
var textBody = $(printstr);
var iframeBody = $('#test').contents().find('body');
iframeBody.append(textBody.html());
To append Html String to the iframe and display it as a webpage.
I am successful if I am trying to
var s="<BODY>
<p>Hello Worlds</p>
</BODY>"
to the page, but I am not sucessfull in complex pages like, say I get this (current) Stack overflow page as a string and try to display it in the iframe. Can I do this..??
Upvotes: 0
Views: 316
Reputation: 66
This will give you an idea about how to achieve this.
var text = "<h1>Hello World</h1>"; //Replace with your content
var node=document.createTextNode(text);
frame.document.body.appendChild(node);//setting iframe content
Upvotes: 1