Unable to access contentDocument properties

I have a very simple setup with an IFrame:

<iframe height="550px" width="100%" border="0" id="iframeID" onload="javascript:proceed()">
</iframe>

The content of the frame is dynamically changed with JavaScript. Now after a page loads, i try to access it, but it won’t work!


var doc = frame.contentDocument ? frame.contentDocument : frame.contentWindow.document;
alert(doc);
alert(doc.body);

The first alert works just like it should, but the second doesn’t appear (and all further execution stops). There is no single property or element of the contentDocument i can reach. Can anyone help me to figure out the problem?


var doc = frame.contentDocument ? frame.contentDocument : frame.contentWindow.document;
alert(doc);
alert(doc.body);

Is the above the content of proceed?

How do you expect to get an onload event if the iframe has no src? Are you applying it elsewhere?

How do you get the frame reference?

Are there any console errors?

Can you see how you’ve made this a difficult question to answer?