Reputation: 1577
I have the following structure of my website:
<html>
<iframe>
<iframe>
</iframe>
</iframe>
<html>
I am prgramming the part of the most inner iframe
. Now I want to determine the available height
of the browser window (starting under the menubar
and ending before possible toolbar
s).
I have IE9 and tried somthing like:
window.innerHeight
(result undefined) and
window.parent.document.body.clientHeight
(not the height I expected).
How do I get the height
? Thanx in advance.
Upvotes: 3
Views: 4923
Reputation: 1577
I tried a bit and found the following one as the for me working solution:
top.document.getElementsByTagName("html")[0].offsetHeight
Upvotes: 0
Reputation: 58
Also note that window.parent is a reference to the window
object for the hosting document. So you can do window.parent.innerHeight
(or window.top.innerHeight
)
Though there is no single way of obtaining the height of the document window, cross brower. See Get the size of the screen, current web page and browser window for a quick, cross browser solution and a more detailed explanation
Upvotes: 0
Reputation: 207511
window.parent.document.body.clientHeight
(not the height I expected). How do I get the height? Thanx in advance.
That is because window.parent
would be the iframe above it, not the top level.
You want to use window.top
Upvotes: 6