Solved

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

Posted on 1998-06-09
2
241 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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now