Mozilla & IE developers seem to have simultaneously changed the implementation of their height elements to represent the Opera implementation… which I previously did not have to worry about.
var height = (document.height !== undefined) ? document.height : document.body.offsetHeight;
When performed on a blank document now returns 0 as the height of the document. My implementation requires knowing the true client viewport to dynamically build on. Chrome and Safari are still acting as they used to.
scrollHeight, and clientHeight are acting exactly the same.
To complicate matters document.height and document.body.offsetHeight are now also taking the full height of the document into account instead of only the viewable area as they used to… I tried an old table spacing method and used a 2000px x 1px transparent andthe document height is set to 2000 now…. naturally Chrome and Safari still work as expected and only give the viewable size.
I am very desperate to fix this issue.
The viewport height is not a property of the document, but of the window viewing it. You get the viewport height from
window.innerHeight.The stuff with
documentis only needed as a fallback for IE, which doesn’t provide thewindow.innerdimensions. IE (technically incorrectly) makes thedocument.documentElementrepresent the viewport, so you can get the height from itsclientHeight, unless you’re in Quirks Mode which (more incorrectly) makesdocument.bodyrepresent the viewport instead. (document.heightis totally non-standard; avoid it.)So in summary, and assuming you need to support Quirks Mode (let’s hope you don’t):