The most accurate method I could come up with uses the following algorithm, although it may have problems with future browsers, a situation which I am definitely not happy with: 1. If window.innerHeight/Width is provided, that is fully trustworthy, use that (Hooray!). 2. Else if document.documentElement.clientHeight/Width is provided and either one is greater than 0, use that. 3. Else use document.body.clientHeight/Width.
Facebook
Blog