Solved

OS detection with VBScript (or javascript in ie3/4)

Posted on 1998-06-09
2
249 Views
Last Modified: 2008-02-01
Does anyone know how to use Javascript or VBScript to detect if the user is using 95, 98 or nt4?  Its gota work under IE3 and 4.

Thanks.
0
Comment
Question by:scottg
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
cyberwizz earned 200 total points
ID: 1279756
Yes,

The navigator.userAgent usually returns that info togther with others.
eg. Mozilla/2.0 (Win16; I)

Try this:

getOS() {
startvar = "(";
endvar = ";";
browser = navigator.userAgent;

for(i=0;i<browser.length;i++)
  {
  if(browser.charAt(i) == startvar)
    {
browser.substring(i-1, browser.length).indexOf(endvar) + i-1;
OS = browser.substring(i+1,end);
    }
 }
return OS;
}

That should work.
0
 
LVL 2

Expert Comment

by:cyberwizz
ID: 1279757
Oops. This line:
browser.substring(i-1, browser.length).indexOf(endvar) + i-1;

Should have read:

end = browser.substring(i-1, browser.length).indexOf(endvar) + i-1;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Non-Resizable Pharagraph 2 18
How to escape unsafe HTML tags 4 36
HTML auto refresh to another site 4 28
Two decimal 5 26
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question