Increase iframe height in parent

I have site A that has an iframe and site B shows up in this iframe. I need to increase the height of the iframe according to the content in it from inside site B. I need some pushing in the right direction to get to some documentation or online resources.


Within an iframe you can access the parents document through the parent object e.g.

parent.document.getElementById('iframe-id').style.height = '500px';