Yet another detection script:
http://www.brackeen.com/detectJava/
- Works on Safari+Win (at least on my machine
- Doesnât require external scripts
Yet another detection script:
http://www.brackeen.com/detectJava/
I see the test for MSVM, but it still finds the java 1.6 one
[quote]Java: 1.6
Complete string found: 1.6.0_12
isPlugin2: true
Detected from: JavaPlugin
[/quote]
it didnât find the oCaps stuff ⌠(never heard of it before!!)
However, once I added;
[quote]
[/quote]
it worked!!
however, it will find java2 plugin first - but if I comment that out, I get:
[quote]Java: 1.1
Complete string found: 1.1
isPlugin2: false
Detected from: MSVM
[/quote]
Yeah that script will try to find the highest version installed. So theoretically it will find the MSVM if no Sun Java is installed
I dunno about the oClientCaps stuff⌠I just copied it from somewhere. Got any solution that doesnât require setting the body id?
this seems to work:
<IE:clientCaps ID=âoClientCapsâ STYLE=âbehavior:url(#default#clientCaps)â/>
and is ignored by FF and others (opera, chrome) - all windows (all I have atm)
http://msdn.microsoft.com/en-us/library/ms531416(VS.85).aspx
Awesome. Updated the script.
stopped working for me on safari but detects java on all other browsers i tested so far. great work!
Safariâs working again. Good olâ try/catch saves the day.
maybe it would be cool to post an how to or something like that just a small html sample of the best working solution
I dunno if this is the best working solution, but Iâm trying it with Google Analytics now. It will take a day or so for the stats to show up. Hereâs what Iâm doing:
<script src="http://mysite/js/detectJava.js" type="text/javascript"></script>
<script type="text/javascript">
if (typeof pageTracker != "undefined") {
var version = detectJava.getVersion();
if (version == "1.6" && detectJava.isPlugin2()) {
version = "1.6uN";
}
pageTracker._trackEvent("java", "version", version);
}
</script>
It will be interesting to compare it to some of my server-side logs if there is an discrepancy. Iâll re-post when I have info.
&& detectJava.isPlugin2()
i am not sure if this will work. deploymentToolkit.isPlugin2() returns only true when the deployment plugin is installed and the deployment plugin is AFAIK only available on windows.
for example dragable applets work perfectly on linux despite the missing deployment plugin which would mean 6uN compatible. (donât ask me whats the technical difference between the deployment plugin and plugin2 and why its not the same thing)
wow awesome work, looks like this is probably the best way to detect java.
just some more results:
I am not sure when the liveconnect part kicks in - because at one point it did after 3 reloads?
That said, this is a huge improvement!
Opera 9.64:
Says: 1.6.0u7 while 1.6.0u12 is running (according to javaconsole).
Detection-type = MimeType
Cool, I updated the script that should fix a few of the problems here. I think it was reporting 1.1 in a few cases where the machine had a higher version.
Ah, good to know. But, really I want to detect new plugin features like the animated splash, java_arguments, separate_jvm, etc. Iâm assuming isPlugin2() is the best way to detect that?
i donât know. But I donât think there are many windows user who explicitly disable the plugin2 and ubuntu should fix plugin2 installation in the next release. Thats why I simply assume that plugin2 is available when 6u10 or later was detected.
[quote]Thats why I simply assume that plugin2 is available when 6u10 or later was detected.
[/quote]
I believe plugin2 wonât be used on FF pre-2, and IE pre-7. Do you have that logic as well?
BTW, I reported issues with the deployment toolkit java detection to the engineers (and pointed to this thread)âŚ
Dmitri
Hereâs the results for running the script for one day on pulpgames.net (which has two Java 1.4 games). 1266 unique events.
Since itâs a game site the users w/o Java are lower than average.
1.6uN 558 40.11%
1.6 479 41.71%
1.5 127 10.39%
Unknown 56 4.60%
1.4 22 1.60%
1.1 15 1.00%
1.3 9 0.60%
92% of the users in the sample have Java 1.5 or higher. Sweet! The only surprise to me is that 1.4 usage is as low as it is.
The only thing I did that might be useful is a way to detect the Java version on Safari+Win. (Calling java.lang.System.getProperty(âjava.versionâ) doesnât work). Rather than explain it, here it is:
getHighestInstalledViaLiveConnect: function() {
// Call version-specific methods until something breaks.
// Only known method that works on Safari/Windows
var version = "0.0";
document.write('<applet id="javaDetectApplet" code="java.applet.Applet" ' +
'width="0" height="0" name="Java" ' +
'style="visibilty: hidden; display: none" ' +
'mayscript="true"></applet>');
var a = document.getElementById('javaDetectApplet');
if (a != null) {
try {
a.isEnabled();
version = "1.1";
}
catch (e11) {
return version;
}
try {
a.getAccessibleContext();
version = "1.3";
}
catch (e13) {
return version;
}
try {
a.isBackgroundSet();
version = "1.4";
}
catch (e14) {
return version;
}
try {
a.isPreferredSizeSet();
version = "1.5";
}
catch (e15) {
return version;
}
try {
a.getBaselineResizeBehavior();
version = "1.6";
}
catch (e16) {
return version;
}
}
return version;
},
great, I will use your script on my own website soon, is that the final version ?
I wouldnât worry about Java1.4 as you said it is a game website, and I really beleave that Java stats on such websites are sligly different then the reality => more Java and more Java 1.6
related to the way you detect Java on Safari + Win, It maybe a good idea when Java is not detected by JavaScript to use this technic it wont be really annoying for visitors as there are few one that doesnât have Java and if there is no java it wont do anything.
So what about when Java is not detected to write an applet and query the version within it ?
yup did a similar thing here, basically wait 10 seconds for java to responded via live connect, if it doesnât assume it isnât available. Works on all browsers including safari and konqueror.