Detect SP2 for XP ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yaron C.

    Detect SP2 for XP ?

    Hi,

    Is there is a way to detect Service Pack 2 for XP in JS ?

    Can I know it from navigator.userA gent ?

    Thanks,

    Yaron
  • Martin Honnen

    #2
    Re: Detect SP2 for XP ?



    Yaron C. wrote:
    [color=blue]
    > Is there is a way to detect Service Pack 2 for XP in JS ?
    >
    > Can I know it from navigator.userA gent ?[/color]

    With IE 6 it seems that
    navigator.appMi norVersion
    contains
    SP2
    if Windows XP service pack 2 is installed thus the check
    if (navigator.appM inorVersion &&
    navigator.appMi norVersion.toLo werCase().index Of('SP2') != -1) {
    // it is SP 2
    }
    should help (as long as not any other browser vendor on another platform
    decides to use that property and put SP2 into it for some reasons).
    I don't think other Windows browsers care about the service pack and
    indicate it in some navigator property.
    And even with IE you are probably better off if you simply do object
    checking e.g.
    var win = window.open('wh atever.html');
    if (win != null && !win.closed) {
    // manipulate window here
    }

    --

    Martin Honnen

    Comment

    • Yaron C.

      #3
      Re: Detect SP2 for XP ?

      Thanks Martin !!!

      Martin Honnen <mahotrash@yaho o.de> wrote in message news:<4157f559$ 0$26684$9b4e6d9 3@newsread2.arc or-online.net>...[color=blue]
      > Yaron C. wrote:
      >[color=green]
      > > Is there is a way to detect Service Pack 2 for XP in JS ?
      > >
      > > Can I know it from navigator.userA gent ?[/color]
      >
      > With IE 6 it seems that
      > navigator.appMi norVersion
      > contains
      > SP2
      > if Windows XP service pack 2 is installed thus the check
      > if (navigator.appM inorVersion &&
      > navigator.appMi norVersion.toLo werCase().index Of('SP2') != -1) {
      > // it is SP 2
      > }
      > should help (as long as not any other browser vendor on another platform
      > decides to use that property and put SP2 into it for some reasons).
      > I don't think other Windows browsers care about the service pack and
      > indicate it in some navigator property.
      > And even with IE you are probably better off if you simply do object
      > checking e.g.
      > var win = window.open('wh atever.html');
      > if (win != null && !win.closed) {
      > // manipulate window here
      > }[/color]

      Comment

      • cwdjr

        #4
        Re: Detect SP2 for XP ?

        I checked this out at my browser "zoo" of 9 browsers and found 3
        browsers that return ;SP2; when asked for navigator.appMi norVersion.
        However the other 7 did not. Since the SP2 update apparently makes
        changes both in the XP OS and IE6 browsers and relatves thereof, this
        response of browsers is no surprise. IE6, MSN9, and MYIE2 0.9.27.68
        return ;SP2; . Opera 7.54 just gives a blank space. Mozilla 1.7.3,
        Netscape 7.2, Firefox 1.0 Preview Release, and Netscape 4.8 return
        undefined. Amaya 8.16 does not have JS installed. The old MSNTV
        browsers, soon to be replaced by a IE6 browser on a new set top box
        just being released, return numbers for various version revisions, but
        no letters. It is possible that some AOL browsers could return ;SP2;
        since some of these are based on IE6, but AOL greatly modifes the
        browser. I have no way to check various AOL browser versions.

        Comment

        • Randy Webb

          #5
          Re: Detect SP2 for XP ?

          cwdjr wrote:
          [color=blue]
          > It is possible that some AOL browsers could return ;SP2;
          > since some of these are based on IE6, but AOL greatly modifes the
          > browser. I have no way to check various AOL browser versions.[/color]

          AOL 9 runnin on WinXP SP2 returns the SP2, but as you pointed out, the
          SP2 is no guarantee that you can assume its going to act as IE6 does,
          there are subtle differences.

          --
          Randy
          comp.lang.javas cript FAQ - http://jibbering.com/faq

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Detect SP2 for XP ?

            Martin Honnen wrote:
            [color=blue]
            > var win = window.open('wh atever.html');
            > if (win != null && !win.closed) {
            > // manipulate window here
            > }[/color]

            I would rather do

            var win = window.open('wh atever.html');
            if (win && !win.closed)
            {
            // manipulate window here
            }

            since `win' could for some reason be `undefined'.


            PointedEars

            Comment

            • Jim Ley

              #7
              Re: Detect SP2 for XP ?

              On Mon, 11 Oct 2004 01:38:05 +0200, Thomas 'PointedEars' Lahn
              <PointedEars@we b.de> wrote:
              [color=blue]
              >Martin Honnen wrote:
              >[color=green]
              >> var win = window.open('wh atever.html');
              >> if (win != null && !win.closed) {
              >> // manipulate window here
              >> }[/color]
              >
              >I would rather do
              >
              > var win = window.open('wh atever.html');
              > if (win && !win.closed)
              > {
              > // manipulate window here
              > }
              >
              >since `win' could for some reason be `undefined'.[/color]

              and if window.open returned false[*]? As it does in certain old
              pop-up blockers I've seen?

              Jim.
              [*] (or true, or any object which didn't have a closed property...)

              Comment

              • Richard Cornford

                #8
                Re: Detect SP2 for XP ?

                Thomas 'PointedEars' Lahn wrote:[color=blue]
                > Martin Honnen wrote:[color=green]
                >> var win = window.open('wh atever.html');
                >> if (win != null && !win.closed) {
                >> // manipulate window here
                >> }[/color]
                >
                > I would rather do
                >
                > var win = window.open('wh atever.html');
                > if (win && !win.closed)
                > {
                > // manipulate window here
                > }
                >
                > since `win' could for some reason be `undefined'.[/color]

                The possibility that - win - is undefined is already covered in the
                original test as in the type-converting equality operation (null ==
                undefined) is true so (win != null) will be false if win is null OR
                undefined. Straight type-converting to boolean might be preferred for
                its relative simplicity and efficiency.

                Richard.


                Comment

                • Thomas 'PointedEars' Lahn

                  #9
                  Re: Detect SP2 for XP ?

                  Jim Ley wrote:
                  [color=blue]
                  > [...] Thomas 'PointedEars' Lahn [...] wrote:[color=green]
                  >> Martin Honnen wrote:[color=darkred]
                  >>> var win = window.open('wh atever.html');
                  >>> if (win != null && !win.closed) {
                  >>> // manipulate window here
                  >>> }[/color]
                  >>
                  >> I would rather do
                  >>
                  >> var win = window.open('wh atever.html');
                  >> if (win && !win.closed)
                  >> {
                  >> // manipulate window here
                  >> }
                  >>
                  >> since `win' could for some reason be `undefined'.[/color]
                  >
                  > and if window.open returned false[*]?
                  > As it does in certain old pop-up blockers I've seen?[/color]

                  Then the first operand would be converted to `false' as well, the
                  second operand would not be evaluated and everything would be fine.
                  [color=blue]
                  >[*] (or true, or any object which didn't have a closed property...)[/color]

                  (Why should it? B0rken popop blockers?) The condition would then evaluate
                  to `true'. Further tests whether `win' can be used as object reference
                  would be necessary. Since the window should be manipulated within the
                  block, this could and should be achieved with feature tests prior to
                  access.


                  PointedEars
                  --
                  "I'd rather be an adjective than a gerund."
                  -- Tom Stoppard (loosely quoted)

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: Detect SP2 for XP ?

                    Richard Cornford wrote:
                    [color=blue]
                    > The possibility that - win - is undefined is already covered in the
                    > original test as in the type-converting equality operation (null ==
                    > undefined) is true so (win != null) will be false if win is null OR
                    > undefined. Straight type-converting to boolean might be preferred for
                    > its relative simplicity and efficiency.[/color]

                    ACK, thanks. I tend to forget about that conversion.


                    PointedEars
                    --
                    Hmmm, well we can fix it, but it's going to cost you...

                    Comment

                    Working...