Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Apr 3, 2000

Querying Your Applet's Browser

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.
Manoj K.
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap