Filling an IFRAME with dynamic content from JavaScript
Tried setting
but that does not work. Solution by Jeffery To works. Just want to add that .innerHTML
might not work in old browsers (read IE old versions) so you can domyIframe.contentWindow
var iFrameWindow = myIframe.contentWindow || myIframe.documentWindow;
var iFrameDoc = iFrameWindow.document;
then use the document open(), write() & close() as above.
I think you're looking for something like:
var iframeDoc = myIframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write('hello world');
iframeDoc.close();