By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

document.clientHeight

P: n/a
Other than Safari 2, what other browsers that support
document.clientHeight ?

I would guess some KHTML did.

I have found the feature, when it is present, to reliably provide the
height of the viewport, excluding scrollbars.

Sep 14 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Sep 14, 3:27*am, dhtml <dhtmlkitc...@gmail.comwrote:
Other than Safari 2, what other browsers that support
document.clientHeight ?

I would guess some KHTML did.

I have found the feature, when it is present, to reliably provide the
height of the viewport, excluding scrollbars.
(element).clientHeight
document.**body**.clientHeight

All the browsers support that, I think.

site:opera.com "clientHeight"
site:mozilla.org "clientHeight"
site:microsoft.com "clientHeight"
site:apple.com "clientHeight"
site:webkit.org clientHeight

--
Jorge.
Sep 14 '08 #2

P: n/a
Jorge wrote:
On Sep 14, 3:27 am, dhtml <dhtmlkitc...@gmail.comwrote:
>Other than Safari 2, what other browsers that support
document.clientHeight ?

I would guess some KHTML did.

I have found the feature, when it is present, to reliably provide the
height of the viewport, excluding scrollbars.

(element).clientHeight
document.**body**.clientHeight

All the browsers support that, I think.
Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.

>
--
Jorge.
Sep 14 '08 #3

P: n/a
On Sep 14, 5:53*pm, dhtml <dhtmlkitc...@gmail.comwrote:
>
Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.
javascript:alert(document.clientHeight)

In a Mac: Opera 9.5x, FF2&3, Safari 3&4, Camino, IE5.23, NS9, iCab3 --
undefined.
--
Jorge.
Sep 14 '08 #4

P: n/a
On Sep 14, 5:53*pm, Jorge wrote:
On Sep 14, 5:53*pm, dhtml wrote:
Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.

javascript:alert(document.clientHeight)

In a Mac: Opera 9.5x, FF2&3, Safari 3&4, Camino, IE5.23, NS9, iCab3 --
undefined.
document.clientHeight is not widely supported (actually browsers that
support it are deprecating its functionality) and it is recommended to
use document.body.clientHeight which is supported in all browsers.

document.clientHeight, in fact, doesn't make any sense as document is
not an element and merely a placeholder for the DOM tree returned from
the underlying markup and is invisible to one's eyes. You don't have
heights for objects that are not even visible.

;) Cheers,
Arun

Sep 15 '08 #5

P: n/a
Arun wrote:
On Sep 14, 5:53 pm, Jorge wrote:
>On Sep 14, 5:53 pm, dhtml wrote:
>>Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.
javascript:alert(document.clientHeight)

In a Mac: Opera 9.5x, FF2&3, Safari 3&4, Camino, IE5.23, NS9, iCab3 --
>>undefined.

document.clientHeight is not widely supported (actually browsers that
support it are deprecating its functionality) and it is recommended to
use document.body.clientHeight which is supported in all browsers.

document.clientHeight, in fact, doesn't make any sense as document is
not an element and merely a placeholder for the DOM tree returned from
the underlying markup and is invisible to one's eyes. You don't have
heights for objects that are not even visible.
Doesn't IE 6, in strict mode, use document.documentElement.clientHeight?

Andrew Poulos
Sep 15 '08 #6

P: n/a
On Sep 15, 2:18 pm, Andrew Poulos wrote:
Arun wrote:
<snip>
>... and it is recommended to use document.body.clientHeight
which is supported in all browsers.
<snip>
Doesn't IE 6, in strict mode, use
document.documentElement.clientHeight?
It would be better to call it "standards", "CSS" or "CSS1Compat" mode
(the first being normal and the last the internal name
(document.compatMode)) and its opposite something like "quirks" or
"BackCompat" mode. Referring to it as "strict" tends to encourage the
misconception that it has some relationship with the distinction
between "strict" and "transitional" in HTML (and when ECMAScript
introduces a "strict" mode (in the next version) there would be
additional confusion).

But yes, when (document.compatMode == 'CSS1Compat') IE 6 client
dimensions are to be found on the documentElement not the body (and
the values read from the body element will be very wrong). But this is
not necessarily true of other browsers that expose a -
document.compatMode - property.
Sep 15 '08 #7

P: n/a
Arun wrote:
On Sep 14, 5:53 pm, Jorge wrote:
>On Sep 14, 5:53 pm, dhtml wrote:
>>Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.
javascript:alert(document.clientHeight)

In a Mac: Opera 9.5x, FF2&3, Safari 3&4, Camino, IE5.23, NS9, iCab3 --
>>undefined.

document.clientHeight is not widely supported (actually browsers that
support it are deprecating its functionality) and it is recommended to
use document.body.clientHeight which is supported in all browsers.
It was removed from Safari. Safari 2.0.4 had it. Not sure which other
browsers have it (probably some KHTML). Seems to be quite rare.

document.clientHeight, in fact, doesn't make any sense as document is
not an element and merely a placeholder for the DOM tree returned from
the underlying markup and is invisible to one's eyes. You don't have
heights for objects that are not even visible.

It could be argued that documentElement.clientHeight returning the
height of the viewport (sans horz scrollbar) makes less sense. It is
ambiguous and doesn't work that way in all browsers.

Should clientHeight return the cleintHeight of the element? That's what
recent past versions of Opera do. What should
documentElement.scrollHeight return? Should it return the scrollHeight
of the html element or the height of the viewport? What about
documentElement.clientTop, or offsetTop?

The viewport is not the documentElement. There's a lot of special
treatment given to the root node for functionality of the viewport. Even
body gets some special treatment, too (overflow, background, event
handlers).

Garrett
;) Cheers,
Arun
Sep 16 '08 #8

P: n/a
dhtml wrote:
Arun wrote:
>On Sep 14, 5:53 pm, Jorge wrote:
>>On Sep 14, 5:53 pm, dhtml wrote:
Most browsers support (element).clientHeight. But document is not an
element. Not all browsers support document.clientHeight.
javascript:alert(document.clientHeight)

In a Mac: Opera 9.5x, FF2&3, Safari 3&4, Camino, IE5.23, NS9, iCab3 --

undefined.

document.clientHeight is not widely supported (actually browsers that
support it are deprecating its functionality) and it is recommended to
use document.body.clientHeight which is supported in all browsers.

It was removed from Safari. Safari 2.0.4 had it. Not sure which other
browsers have it (probably some KHTML). Seems to be quite rare.

>document.clientHeight, in fact, doesn't make any sense as document is
not an element and merely a placeholder for the DOM tree returned from
the underlying markup and is invisible to one's eyes. You don't have
heights for objects that are not even visible.


It could be argued that documentElement.clientHeight returning the
height of the viewport (sans horz scrollbar) makes less sense. It is
ambiguous and doesn't work that way in all browsers.

Should clientHeight return the cleintHeight of the element? That's what
recent past versions of Opera do. What should
documentElement.scrollHeight return? Should it return the scrollHeight
of the html element or the height of the viewport?
(I meant "document's scrollable area").......^^^

What about
documentElement.clientTop, or offsetTop?

The viewport is not the documentElement. There's a lot of special
treatment given to the root node for functionality of the viewport. Even
body gets some special treatment, too (overflow, background, event
handlers).

Garrett
>;) Cheers,
Arun
Sep 16 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.