1

How do I get the pageHeight illustrated in the image below? (Image is from Get the size of the screen, current web page and browser window).

No jquery! Crossbrowser, IE9+

Every answer out there seems to be either jquery or else it gets the windowHeight (viewport size). This number should NOT change as the user makes their screen smaller and scrollbars appear.

I tried this

var w = window,
    d = document,
    e = d.documentElement,
    g = d.getElementsByTagName('body')[0],
    x = w.innerWidth || e.clientWidth || g.clientWidth,
    y = w.innerHeight|| e.clientHeight|| g.clientHeight;
alert(y);

But y is just the height of what's visible, not the height of what is potentially visible, including when you use the scrollbar.

I've also tried:

height = document.body.clientHeight;
height = window.innerHeight;

Same result.

Community
  • 1
  • 1
user984003
  • 28,050
  • 64
  • 189
  • 285
  • 1
    The height of the document? http://stackoverflow.com/questions/1145850/how-to-get-height-of-entire-document-with-javascript – George Mar 18 '14 at 09:06
  • Yes, that seems to be what I need! Didn't realize that this was called the document. Searched for page and view and height... – user984003 Mar 18 '14 at 09:12

0 Answers0