• info@maidenwaygroup.co.uk
  • Cavaghan Gardens Carlisle CA1 3BF. 07377675242. 01228 536449

iframe contentwindow onload

If you found this post helpful, please consider donating to support my work. **Update (15 Sep 2009): **Added section about attachEvent() based on Christopher’s comment.

You can get a reference to an iframe using getElementById. However, if I set document.domain to “nczonline.net” in both the containing page and the iframe page, the two are allowed to communicate. In order for the containing page to access the iframe’s window object in any meaningful way, the domain of the containing page and the iframe page need to be the same (details). Since the iframe element is owned by the containing page, you never need to worry about cross-domain restrictions. The result looked like this: This code assigned a method called _myMethod() onto the iframe element. I had resigned myself to using one method of detecting an iframe loading for Internet Explorer and another for every other browser, so I continued on my task. An inner frame that works much like the HTML