I want to access and modify the iframe content. when I do it like this, Chrome 16 and Firefox 9 return "Cannot read property 'document' of undefined". What I am doing wrong?
<iframe id="frame"></iframe>
...
var myIFrame = document.getElementById("frame");
var content = myIFrame.contentDocument.document.body.innerHTML;
alert(content);