How about
window.innerWidth
window.innerHeight
in ExtJS you can use getViewSize( )
Another plain JS approach is
This function will return any document height (cross-browser) and if the documents body height is less than the viewport height then it will return the viewport height instead. Cause I think your doc is empty at the time you check this should perfectly work for you.
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}