Should I use browser detection code or not?

D

delerious

I want to know the height of the viewable portion of a page (minus scrollbar)
in Opera and Mozilla.

For Opera, I could use document.body.clientHeight. Unfortunately, this won't
work in Mozilla because Mozilla also subtracts the sizes of the top and bottom
margins.

For Mozilla, I could use document.documentElement.clientHeight.
Unfortunately, this won't work in Opera because Opera returns the height of
the entire page, not just the viewable portion.

So I have two options:

1) Use browser detection code to determine if the user is running Opera or
Mozilla, and then use the appropriate clientHeight code.

2) Use window.innerHeight. This is supported by both Opera and Mozilla,
however it returns the height of the viewable portion of the page *including*
the scrollbar. Is there any way to determine the width of a scrollbar? If
not, then I would have to make an assumption and subtract the hardcoded width
of the scrollbar from window.innerHeight... but only if the scrollbar is
present, is there a way to determine that?
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn
I want to know the height of the viewable portion of a page (minus scrollbar)
in Opera and Mozilla.

Before we go on I would like to know why do you think you need to know
that and to see your munged `From:' header replaced with something that
conforms to Internet/Usenet standards.[1]


OP : ignore that. TL is obsessed.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn
I want to know the height of the viewable portion of a page (minus scrollbar)
in Opera and Mozilla.

Before we go on I would like to know why do you think you need to know
that and to see your munged `From:' header replaced with something that
conforms to Internet/Usenet standards.[1]

OP : ignore that. TL is obsessed.

Read you again in a few weeks.


PointedEars
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn
Dr said:
Thomas 'PointedEars' Lahn
(e-mail address removed) wrote:
I want to know the height of the viewable portion of a page (minus scrollbar)
in Opera and Mozilla.

Before we go on I would like to know why do you think you need to know
that and to see your munged `From:' header replaced with something that
conforms to Internet/Usenet standards.[1]

OP : ignore that. TL is obsessed.

Read you again in a few weeks.

Refusal to read refutations is a sign of weakness of stance.

However, it will do no harm, since the intent is to inform the OP rather
than to educate TL.

He is probably still miffed because he cannot understand how my E-mail
system is standards-compliant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top