admin管理员组文章数量:1388153
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.
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.
3 Answers
Reset to default 6window.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
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
I tried a bit and found the following one as the for me working solution:
top.document.getElementsByTagName("html")[0].offsetHeight
本文标签: javascriptget available height of browser window from within iframesStack Overflow
版权声明:本文标题:javascript - get available height of browser window from within iframes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744507210a2609659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论