Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Detect SP2 for XP ?

Reply
Thread Tools

Detect SP2 for XP ?

 
 
Yaron C.
Guest
Posts: n/a
 
      09-27-2004
Hi,

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

Can I know it from navigator.userAgent ?

Thanks,

Yaron
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      09-27-2004


Yaron C. wrote:

> Is there is a way to detect Service Pack 2 for XP in JS ?
>
> Can I know it from navigator.userAgent ?


With IE 6 it seems that
navigator.appMinorVersion
contains
SP2
if Windows XP service pack 2 is installed thus the check
if (navigator.appMinorVersion &&
navigator.appMinorVersion.toLowerCase().indexOf('S P2') != -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('whatever.html');
if (win != null && !win.closed) {
// manipulate window here
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Yaron C.
Guest
Posts: n/a
 
      09-28-2004
Thanks Martin !!!

Martin Honnen <(E-Mail Removed)> wrote in message news:<4157f559$0$26684$(E-Mail Removed)-online.net>...
> Yaron C. wrote:
>
> > Is there is a way to detect Service Pack 2 for XP in JS ?
> >
> > Can I know it from navigator.userAgent ?

>
> With IE 6 it seems that
> navigator.appMinorVersion
> contains
> SP2
> if Windows XP service pack 2 is installed thus the check
> if (navigator.appMinorVersion &&
> navigator.appMinorVersion.toLowerCase().indexOf('S P2') != -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('whatever.html');
> if (win != null && !win.closed) {
> // manipulate window here
> }

 
Reply With Quote
 
cwdjr
Guest
Posts: n/a
 
      09-28-2004
I checked this out at my browser "zoo" of 9 browsers and found 3
browsers that return ;SP2; when asked for navigator.appMinorVersion.
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.
 
Reply With Quote
 
Randy Webb
Guest
Posts: n/a
 
      09-29-2004
cwdjr wrote:

> 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.


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.javascript FAQ - http://jibbering.com/faq
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      10-10-2004
Martin Honnen wrote:

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


I would rather do

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

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


PointedEars
 
Reply With Quote
 
Jim Ley
Guest
Posts: n/a
 
      10-10-2004
On Mon, 11 Oct 2004 01:38:05 +0200, Thomas 'PointedEars' Lahn
<(E-Mail Removed)> wrote:

>Martin Honnen wrote:
>
>> var win = window.open('whatever.html');
>> if (win != null && !win.closed) {
>> // manipulate window here
>> }

>
>I would rather do
>
> var win = window.open('whatever.html');
> if (win && !win.closed)
> {
> // manipulate window here
> }
>
>since `win' could for some reason be `undefined'.


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...)
 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      10-11-2004
Thomas 'PointedEars' Lahn wrote:
> Martin Honnen wrote:
>> var win = window.open('whatever.html');
>> if (win != null && !win.closed) {
>> // manipulate window here
>> }

>
> I would rather do
>
> var win = window.open('whatever.html');
> if (win && !win.closed)
> {
> // manipulate window here
> }
>
> since `win' could for some reason be `undefined'.


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.


 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      10-12-2004
Jim Ley wrote:

> [...] Thomas 'PointedEars' Lahn [...] wrote:
>> Martin Honnen wrote:
>>> var win = window.open('whatever.html');
>>> if (win != null && !win.closed) {
>>> // manipulate window here
>>> }

>>
>> I would rather do
>>
>> var win = window.open('whatever.html');
>> if (win && !win.closed)
>> {
>> // manipulate window here
>> }
>>
>> since `win' could for some reason be `undefined'.

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


Then the first operand would be converted to `false' as well, the
second operand would not be evaluated and everything would be fine.

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


(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)
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      10-12-2004
Richard Cornford wrote:

> 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.


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


PointedEars
--
Hmmm, well we can fix it, but it's going to cost you...
 
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
Adminpak SP2 , Windows Server x64 SP2 =?Utf-8?B?QmrDuHJu?= Windows 64bit 2 09-03-2007 12:54 PM
MDAC 2.8 SP2 for W2K3 R2 x64 SP2 =?Utf-8?B?SmFja04=?= Windows 64bit 2 06-07-2007 12:00 AM
Novell Client 4.92 SP2 and Windows XP SP2 Yogi Computer Support 1 07-22-2005 01:33 AM
WIN XP SP2 ERROR: Can not read from or write to the data base. SP2 installation did not complete Father Jack Hackett Computer Support 5 01-26-2005 06:08 PM
Re: IE 6.0 with SP2 and Windows XP SP2 and Adobe Acrobat & Reader 6.0 George ASP .Net 5 08-24-2004 12:11 PM



Advertisments