jsGuru.com
HomeIntroductionFundamentalsCompatibilityResourcesComments   Browser Sniffing - B/V/P Method
 
As an example, let's use the information returned by your browser's navigator object:
 
   

 
 

First, we want to find out which browser is in use. The most common browsers are Netscape Navigator and Microsoft Internet Explorer. Thus we want a variable "sBrowser" that will contain a short string identifying the browser. We can accomplish that with the javaScript code:
 
 
   
var sBrowser = (navigator.appName.indexOf("Netscape") >= 0) ?
  "NS" :
  (navigator.appName.indexOf("Microsoft") >= 0) ?
    "IE" : "OTHER";
 
 
   

 
 
     
   
Now let's take a look at how to find the version.
 
Continue
 
       
    © 1999 bnsDesigns