Within an iFrame, we need to get the parent's window/document height.
Is there a way to get this using jQuery?
I know we can use $(document).height() to get a page's height. I just can't figure out how to get the parent's value from within the iFrame.
Please help!
I tried the clientHeight approach on a website where both Iframes where on the same domain and it didn't work. (return 0).
After a lot of testing the best way I have found (and I'll be happy to learn a better way) is to create a function on the parent which returns the document height, something like:
Parent:
Iframe:
In jQuery you can do
Another possibility is :
jQuery is not needed.
parent.document.body.clientHeight
That works for me with IE7 and FF3.