Is it possible to load content into an iframe and load the iframe to render the content?

26 de afișări
Accesați primul mesaj necitit

Devan Shah

necitită,
15 mai 2016, 22:04:3715.05.2016
– karma-users
Hello

I am trying to inject a full html document into an iframe, like so:

var unitTestcaseHTML = "<full html document with all the tags and all>";

var iframe = document.createElement('iframe');
iframe.id = "unitTestcaseIframe";
document.body.appendChild(iframe);
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(unitTestcaseHTML);
iframe.contentWindow.document.close();

When I do this, in the testcase it self I am not able to access the iframe document with the content that I provided it keeps getting empty content. However when I open it in debug it looks like everything is rendered and I can see it all.

Thanks
Devan

Devan Shah

necitită,
15 mai 2016, 22:15:2215.05.2016
– karma-users
Ignore This, I figured it out
Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi