Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Should I use browser detection code or not?

Reply
Thread Tools

Should I use browser detection code or not?

 
 
delerious@no.spam.com
Guest
Posts: n/a
 
      12-08-2003
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?


 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-08-2003
http://www.velocityreviews.com/forums/(E-Mail 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]


PointedEars
___________
[1] http://www.interhack.net/pubs/munging-harmful/
 
Reply With Quote
 
 
 
 
Dr John Stockton
Guest
Posts: n/a
 
      12-09-2003
JRS: In article <(E-Mail Removed)>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<(E-Mail Removed)> posted at Tue, 9 Dec 2003 00:26:50 :-
>(E-Mail 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.

--
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.
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-09-2003
Dr John Stockton wrote:

> Thomas 'PointedEars' Lahn
>> (E-Mail 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.


PointedEars
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      12-10-2003
JRS: In article <(E-Mail Removed)>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<(E-Mail Removed)> posted at Wed, 10 Dec 2003 00:04:39 :-
>Dr John Stockton wrote:
>
>> Thomas 'PointedEars' Lahn
>>> (E-Mail 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.

--
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mobile browser detection and redirection Carlos ASP .Net 4 08-11-2009 08:28 AM
browser detection and redirection jaydev HTML 41 10-27-2006 02:53 PM
browser detection and redirection jaydev ASP .Net 1 10-23-2006 08:53 PM
browser detection for mobile devices Phil Townsend ASP .Net 1 12-02-2004 05:20 PM
A valid use for browser detection? Michael Winter Javascript 7 02-04-2004 12:58 PM



Advertisments