I generate an iFrame dynamically like this
var iframe=document.createElement('iframe');
document.body.appendChild(iframe);
var iframedoc=iframe.contentDocument||iframe.contentWindow.document;
iframedoc.body.innerHTML="HI";
Fiddle: http://jsfiddle.net/Pbj7S/
It works in Google Chrome, Opera, Safari, but not in Firefox.
Any idea why?
This works :
The problem was that you were trying to access the iframe document before it was available in the DOM.
The delay isn’t important, the important point is that browsers update the display (and some js accessible objects in the case of Firefox) only after the js thread has finished working.