Meaningless Drivel is fun!*
The moose likes Applets and the fly likes detecting browser name/version from an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "detecting browser name/version from an Applet" Watch "detecting browser name/version from an Applet" New topic
Author

detecting browser name/version from an Applet

Karen Parker
Greenhorn

Joined: May 16, 2001
Posts: 15
Does anyone know whether it's possible for an applet to detect the browser it is being run in? I have an applet that needs to know whether the user is browsing with Netscape or IE. I know that I can find this out with Javascript and then pass it as an applet parameter, but I'm hoping there's a way to do it from within the applet as well.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I think you're going to have to pass it as a parameter from JavaScript... I know of no way for the applet to detect what kind of browser it is running in...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Karen,
Try the code below to see how it can be done.

Enjoy,
Manfred.
Rohit Agarwal
Greenhorn

Joined: Jul 13, 2001
Posts: 9
Concurring with the same topic. Where do the output of the System.out.println in an applet go to. I cant see them on the browser nor in the java console
Also, can we find out which operating system i am running too?
Rohit
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Manfred,

Pretty snazzy!

Rohit,

System.out.println should be printing to the java console in the browser, or to the command-prompt window that launched the browser ( for appletviewer and Unix-related browsers ).

You can get the OS by using


Look in the Java API under the System class, getProperties() method for more.

-Nate
 
jQuery in Action, 2nd edition
 
subject: detecting browser name/version from an Applet