473,078 Members | 4,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,078 software developers and data experts.

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

Thanks,

Yaron
Jul 23 '05 #1
9 6462


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/
Jul 23 '05 #2
Thanks Martin !!!

Martin Honnen <ma*******@yahoo.de> wrote in message news:<41***********************@newsread2.arcor-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
}

Jul 23 '05 #3
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.
Jul 23 '05 #4
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
Jul 23 '05 #5
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
Jul 23 '05 #6
On Mon, 11 Oct 2004 01:38:05 +0200, Thomas 'PointedEars' Lahn
<Po*********@web.de> 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...)
Jul 23 '05 #7
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.
Jul 23 '05 #8
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)
Jul 23 '05 #9
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...
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows that please share. Particularly I would like to...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
23
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last statement returns an empty collection when running from...
10
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
6
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
12
by: Patrick Dugan | last post by:
I have an vb.net application that is a module that uses a "application.run" in the sub main to start. There is no form involved (just a system tray icon) How can you detect when the application...
4
by: Chris Johnson | last post by:
Hey all, I have a small app I have developed that periodically pings a list of server and returns their status. Given my environment I have setup the program such that a server can be down 4...
1
by: mjobbe | last post by:
Hi, I'm creating an MSI for a client app using a Visual Studio Setup Project. I'm trying to detect if Internet Explorer is running on the target computer before I start the installation. How do I...
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the popup window. The app is a form based...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
3
by: efe2023 | last post by:
Hello Everybody, There is SQL Server 2008 R2 database with MS Access front-end (linked ODBC tables). I can see all linked tables in MS Access and can add new rows. However, when trying to update...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.