Should I use browser detection code or not?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • delerious@no.spam.com

    #1

    Should I use browser detection code or not?

    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.c lientHeight. 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.docume ntElement.clien tHeight.
    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.innerHei ght. 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.innerHei ght... but only if the scrollbar is
    present, is there a way to determine that?


  • Thomas 'PointedEars' Lahn

    #2
    Re: Should I use browser detection code or not?

    delerious@no.sp am.com wrote:
    [color=blue]
    > I want to know the height of the viewable portion of a page (minus scrollbar)
    > in Opera and Mozilla.[/color]

    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/

    Comment

    • Dr John Stockton

      #3
      Re: Should I use browser detection code or not?

      JRS: In article <3FD508BA.20208 00@PointedEars. de>, seen in
      news:comp.lang. javascript, Thomas 'PointedEars' Lahn
      <PointedEars@we b.de> posted at Tue, 9 Dec 2003 00:26:50 :-[color=blue]
      >delerious@no.s pam.com wrote:
      >[color=green]
      >> I want to know the height of the viewable portion of a page (minus scrollbar)
      >> in Opera and Mozilla.[/color]
      >
      >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][/color]


      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.demo n.co.uk/js-index.htm> JSc maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JSc/&c, FAQ topics, links.

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Should I use browser detection code or not?

        Dr John Stockton wrote:
        [color=blue]
        > Thomas 'PointedEars' Lahn[color=green]
        >> delerious@no.sp am.com wrote:[color=darkred]
        >>> I want to know the height of the viewable portion of a page (minus scrollbar)
        >>> in Opera and Mozilla.[/color]
        >>
        >> 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][/color]
        >
        > OP : ignore that. TL is obsessed.[/color]

        Read you again in a few weeks.


        PointedEars

        Comment

        • Dr John Stockton

          #5
          Re: Should I use browser detection code or not?

          JRS: In article <3FD65507.60801 02@PointedEars. de>, seen in
          news:comp.lang. javascript, Thomas 'PointedEars' Lahn
          <PointedEars@we b.de> posted at Wed, 10 Dec 2003 00:04:39 :-[color=blue]
          >Dr John Stockton wrote:
          >[color=green]
          >> Thomas 'PointedEars' Lahn[color=darkred]
          >>> delerious@no.sp am.com wrote:
          >>>> I want to know the height of the viewable portion of a page (minus[/color][/color]
          >scrollbar)[color=green][color=darkred]
          >>>> 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][/color]
          >>
          >> OP : ignore that. TL is obsessed.[/color]
          >
          >Read you again in a few weeks.[/color]

          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.demo n.co.uk/js-index.htm> JSc maths, dates, sources.
          <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JSc/&c, FAQ topics, links.

          Comment

          Working...