Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

detecting browser name/version from an Applet

 
Karen Parker
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karen,
Try the code below to see how it can be done.

Enjoy,
Manfred.
 
Rohit Agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic