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

Should I use browser detection code or not?

P: n/a
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?
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
de*******@no.spam.com 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]
PointedEars
___________
[1] http://www.interhack.net/pubs/munging-harmful/
Jul 20 '05 #2

P: n/a
JRS: In article <3F**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@web.de> posted at Tue, 9 Dec 2003 00:26:50 :-
de*******@no.spam.com 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.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JSc maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JSc/&c, FAQ topics, links.
Jul 20 '05 #3

P: n/a
Dr John Stockton wrote:
Thomas 'PointedEars' Lahn
de*******@no.spam.com 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.
PointedEars
Jul 20 '05 #4

P: n/a
JRS: In article <3F**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@web.de> posted at Wed, 10 Dec 2003 00:04:39 :-
Dr John Stockton wrote:
Thomas 'PointedEars' Lahn
de*******@no.spam.com wrote:
I want to know the height of the viewable portion of a page (minusscrollbar) 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.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JSc maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JSc/&c, FAQ topics, links.
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.