D
Daniel Kabs
Hi there,
to make a long story short: in Internet Explorer 8, I am having problems
getting the correct height of the HTML element.
As you know, the HTML element is the outermost box in a document. The
W3C has standardized document.documentElement as a shortcut to this
element through client side Javascript. The height of the HTML element
can be gathered from document.documentElement.scrollHeight. See MSDN for
further reference:
documentElement Property
http://msdn.microsoft.com/en-us/library/ms533739(VS.85).aspx
scrollHeight Property
http://msdn.microsoft.com/en-us/library/ms534615(VS.85).aspx
Now document.documentElement.scrollHeight gives different results on
IE6/7 and IE8.
As an example, try this short page (which is rendered in
standards-compliant mode):
http://www.colincochrane.com/examples/doctypes/html401-transitional.html
Then execute the following Bookmarklet:
javascript:alert(document.documentElement.scrollHeight);void(document.documentElement.style.border="1px
solid green");
It outputs the height of the HTML element (and creates a green border
around the HTML element to make is visually prominent).
I get the following results
IE6: 149
IE7: 149
IE8: 812
Why is this?
How can I get a consistent reading of the height of the HTML element in
all versions of IE?
Thanks for any help in advance,
Daniel
--
,-. . . .
,-. ,-. | | ,-. /,-.\ | , ,-. |-. ,-. . ,-| ,-.
| | |-' ||| `-. |,-|| |< ,-| | | `-. | | | |-'
' ' `-' `^' `-' \`-^/ ' ` `-^ ^-' `-' ' :; `-^ `-'
`-'
to make a long story short: in Internet Explorer 8, I am having problems
getting the correct height of the HTML element.
As you know, the HTML element is the outermost box in a document. The
W3C has standardized document.documentElement as a shortcut to this
element through client side Javascript. The height of the HTML element
can be gathered from document.documentElement.scrollHeight. See MSDN for
further reference:
documentElement Property
http://msdn.microsoft.com/en-us/library/ms533739(VS.85).aspx
scrollHeight Property
http://msdn.microsoft.com/en-us/library/ms534615(VS.85).aspx
Now document.documentElement.scrollHeight gives different results on
IE6/7 and IE8.
As an example, try this short page (which is rendered in
standards-compliant mode):
http://www.colincochrane.com/examples/doctypes/html401-transitional.html
Then execute the following Bookmarklet:
javascript:alert(document.documentElement.scrollHeight);void(document.documentElement.style.border="1px
solid green");
It outputs the height of the HTML element (and creates a green border
around the HTML element to make is visually prominent).
I get the following results
IE6: 149
IE7: 149
IE8: 812
Why is this?
How can I get a consistent reading of the height of the HTML element in
all versions of IE?
Thanks for any help in advance,
Daniel
--
,-. . . .
,-. ,-. | | ,-. /,-.\ | , ,-. |-. ,-. . ,-| ,-.
| | |-' ||| `-. |,-|| |< ,-| | | `-. | | | |-'
' ' `-' `^' `-' \`-^/ ' ` `-^ ^-' `-' ' :; `-^ `-'
`-'