I’m using Moodle: 
I am trying to run some Javascript from within the frame to get the browser window height, so I can alert the user if they are using a less then optimal browser size.
I’v tried things like:
window.top.document.body.offsetHeight
document.documentElement.clientHeight
$(document).height()
$(window).height()
But they all give static heights which never change when I resize the browser.
Oh and it has to work in IE8.
You have to use the
parentproperty of the iFrame window:Run this code from within the iFrame, it will return the height of the parent window:
However, if you’re using jQuery 1.8.0 this may not work if your browser is in quirks mode. As of jQuery 1.8.0, the command
$(window).height()stopped working for Internet Explorer in quirks mode and they don’t plan to fix it.If you’re using jQuery 1.8.0, use this slight variation instead:
This will ensure cross-browser support, even in IE quirks mode 😉
http://www.w3schools.com/jsref/prop_win_parent.asp