My definition of “viewport” is everything between the browser’s borders (visible area + scrollbar)
As you can see, I tried:
- document.body VS document.documentElement
- scroll* client* offset*
- getBoundingClientRect()
- html { 100% }
- body { 100% }
The Internet Explorer 7 bug per say is that offset* and getBoundingClientRect() do not include the scrollbar
Hide the scrollbar, get the width/height in the next line of code and show the scrollbar again.
This will all happen before the display gets updated, so the scrollbars won’t flicker and you’ll have the full dimensions.