Solved

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

Posted on 1998-06-09
2
244 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now