Re: browser detecting java version
On Feb 9, 7:22 am, "Oliver Wong" <o...@castortech.com> wrote:
<s...@enablearning.com> wrote in message
news:1170964244.491229.283400@v45g2000cwv.googlegroups.com...
I have seen an applet that can detect the version of Java running, but
this can only display the output in the applet. Is there any way to
detect the version of java running on the client in an html or jsp
page so that that information can be put into a form to be posted back
to the server?
You could program your applet to connect back to the server it was
downloaded from and submit whatever info it gathered,
There are a number of ways to communicate the
information back.
1) For general statistics, the applet might load a different
'version' of some resource for each major version, then
at the end of the month, the hits on the resources
indicate the bulk data.
To get more specific and instant results..
2) http://www.physci.org/codes/java/JavaVersionApplet.java
redirects the user to a different page, with the major
version tacked on the end of the string. This version
has the disadvantage that even if Java is installed,
any number of things might block the showDocument
method, so the page might just 'sit there'. But *
3) Attempt to open a URL directly back to the server,
from inside the applet. I expect this is what Oliver
meant, and is the most reliable.
...but if the user
doesn't have Java installed at all, your applet will not run and thus not
submit anything back.
* To cover both 'no redirect/page change'
and 'no Java' situations, it might pay to ..
1) Direct the user to a page that says
"Test not done - no 'redirect' available"
but *also* includes an immediate page
redirect, to the actual test.
2) For the people that end up at the
'redirect/test' page, include a message
"Testing Java Version" and an applet
that attempts to showDocument(), along
with a redirect set for 10, or 20 seconds.
The redirect points to a page that says
"no Java" (to both the user and you).
3) Using the applet, include the Java version
in the URL to which you 'showDocument'.,
and read the information there.
But ultimately, why do you want to know?
Note that if you have a Java pplet that requires
1.4+, it can be launched using web start. The
minimum version can be specified in the JNLP
file.
This way, the user gets the applet, retains there
privacy, and the deployer never has to worry about
what the user is (or is not) running, or how their
browser is configured. Well OK - less worrying
about the browser - it is not completely removed.
Andrew T.