Sometimes you write an applet that depends on a Microsoft Internet Explorer-specific extension which is not common to all browsers. How do you find out if the browser that’s running your applet supports the extension that you want to use?
Java provides a number of underlying classes that provide information about the system. For example, they can tell you what security manager is loaded, what OS your applet is running under, and which browser is running. You can then use this information to create an applet that’s sensitive to the browser under which it’s running.
First, get information about the system as a whole via the java.lang.System class method getProperty. The getProperty method allows the developer to get a wide variety of environment-specific information. It returns a string that represents the property that’s been requested. For example, to determine the OS that an applet is running under we could ask:
String os = System.getProperty("os.name");
Then use the information returned to build a browser-sensitive applet using the java.version and java.vendor properties.