For nearly a decade i\'ve been using:
document.body.scrollHeight
to return the \"ideal\" height of the browser window. This worke
document.documentElement.scrollHeight I believe.
For viewport it's window.innerHeight for modern browsers.
If the above aren't what you want, here's a list of a bunch of them: