Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to detect browser settings?

 
Chinh Tran Nam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a strange requirement from my client to write a script (in Java, JSP, Javascript or whatever applicable for their JSP application) to check browser settings (IE) to see if it's configured as they need. Here are some settings it has to check:
- Browser version
- JVM version
- Cache Settings
- Font settings
- Security Settings: ActiveX control and plug-in?
- ...

and other system settings like Regional settings, Folder Options,...

Please let me know how to deal with this?
Thanks in advance.
 
Pradeep LV
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To check the browser version, here is the function written is Javascript

function CheckBrowser()
{
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)));

if (this.nav)
{
BrowserType='NS';
}
this.ie = (agt.indexOf("msie") != -1);

if (this.ie)
{
BrowserType='IE';
}

if (agt.indexOf("netscape6")!=-1)
{
BrowserType='NS6';
}

get_os();

}
 
Tina Long
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can look at the request header information. You can read about that in the online book found at: Core Servlets and Java Server Pages

The other thing you can look at is system properties. There is alot of information stored in all those properties.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic