How do I find out what browser my applet is running in?

John Zukowski

Some browsers support the "browser" system property. However, it is non-standard, and the plugin will throw a security exception if you try to read it. A potentially better way is to get the AppletContenxt with getAppletContext() and get its class name (getAppletContext().getClass().getName()). The following table shows the expected values returned, though different browser versions might return different values:

Netscape netscape.applet.MozillaAppletContext
Microsoft com.ms.applet.BrowserAppletFrame
HotJava sunw.hotjava.tags.TagAppletPanel
Appletviewer sun.applet.AppletViewer