I have an IFRAME that should be filled with content from JavaScript. Had the content be on the server all I had to do is:
function onIFrameFill() {
myIframe.location.href = "HelloWorld.html";
}
But the content I have is a HTML page generated on the client and represented as a string (I have not much influence on it). How can I populate the content of the my iframe programatically?
I think you're looking for something like:
What about
.innerHTML
?Tried setting
but that does not work. Solution by Jeffery To works. Just want to add that
might not work in old browsers (read IE old versions) so you can do
.innerHTML
myIframe.contentWindow
then use the document open(), write() & close() as above.