devxlogo

Get Browser Information

Get Browser Information

Sometimes, you need to find the Browser in which an applet is loaded. This small bit of code can do the job:

 public void getBrowserInfo(){  String vendor = System.getProperty("java.vendor.url").toLowerCase();  browser = UNKNOWN_BROWSER;  if(vendor.indexOf("www.microsoft.com") != -1) browser = IE;  if(vendor.indexOf("java.sun.com")      != -1) browser = NS6;  if(vendor.indexOf("home.netscape.com") != -1) browser = NS47;}

devx-admin

Share the Post: