FireFix and Object tag
I have a JRE 1.5.0_11 that I want users of my applet to download/use. But I cannot get FireFox to behave properly.
Assume client machine currently has no java plugins.
Case 1: using <OBJECT type='application/x-java-applet;version=1.5'...codebase='<url to my jre>' >
with version='1.5', FireFox automatically loads up JRE 6 directly from the Sun site. I do not want this to happen.
Case 2: using <OBJECT type='application/x-java-applet;version=1.5.0'...codebase='<url to my jre>' >
with version='1.5.0' FireFox looks for plugins and then puts up a page stating "Unkown Plugin (application/x-java-applet;version1.5.0)" but provides a Manual Install button which activates the JRE executable that I provide.
This part is great and I can tolerate the "Unknown Plugin" part although it would be nice if it didn't appear this way.
The problem here is that once the JRE is installed and I perform an about:plugins within FireFox, the only listing that closely resembles my "version" value is application/x-java-applet;version=1.5. So next time my applet loads, the plugin check will once again fail because its set to look for version 1.5.0 and the user will be prompted to manually install again.
And again, if I revert back to version=1.5, then we're back with Scenario 1 for clean machines.
Does anybody know how to get this to work properly?
[1438 byte] By [
gambit-77a] at [2007-11-27 7:36:26]

# 1
Firefox is behaving properly.What you want to do is plugin detection first using javascript.If Java 1.5 is installed, then write the object/embed tag to the web page. If Java 1.5 is not installed, then write an error message or whatever.
# 2
Is there some new way to detect the Java version with Javascript? Considering that invoking Java code via Javascript doesn't work in IE, last I checked?
You should use the object and embed tag combination, cuz FF uses embed, not object, I believe. Of course, embed doesn't have quite the full set of controls that object does.
# 3
The most standard way to fully detect is to embed an applet in a page, and query the applet to get the java version. However, you have to wait for the applet to fully load, initialize, and run before you can get the result. This is a mixture of a java applet and javascript that reveals the java version for all browsers.
On the other hand, it would be very nice if there was a javascript only method to detect Java:
For FF, this is easy. You just look at the navigator.plugins array.
For IE, it is alot more difficult, but maybe not entirely impossible. However, such detection requires alot of javascript code since IE does not make it easy (the smallest I could get it is 5500 bytes of code), and the java plugin will be activated during detection (no way to avoid).
I have been trying to experiment with Java detection using only javascript. Here is what I have so far:
http://www.pinlady.net/test/PluginDetect.htm
I have not released any source code for this PluginDetect javascript at this point, because the technique I use is very experimental and thus unproven so far.
# 4
Thanks for all the respones so far...but I'm still puzzled by this dilemna.
The OBJECT tag can be used with FireFox with some modifications. So just for experimentation I reverted back to the EMBED tag and still arrive at the same behavioral difference between FireFox and AE. (NOTE: I have separate functions that are called to render OBJECT for IE and EMBED for FireFox - I am not using mixed rendering).
With FireFox and embed using...
<embed width="100%" height="100%" pluginspage="http://myMachine:7001/download/jre-1_5_0_11-windows-i586-p.exe"
scriptable="true"
mayscript="true"
cache_option="Plugin"
id="appletPlugIn"
type="application/x-java-applet;version=1.5.0"/>
I get the following behavior
1. Run applet on clean machine.
2. FireFox does not detect a current 1.5.0 plugin and offers my JRE installer to manually run.
3. User manually runs the installer.
4. After this JRE is installed, it appears in about:plugins, it gets listed with a value of "version=1.5".
5. So when my applet attempts to run, there is no match found because the EBMED tag is specifying "1.5.0" rather than "1.5" and the user is once again prompted to install the JRE once again.
And if I change my EMBED tag to use only "1.5" for the version:
<embed width="100%" height="100%" pluginspage="http://myMachine:7001/download/jre-1_5_0_11-windows-i586-p.exe"
scriptable="true"
mayscript="true"
cache_option="Plugin"
id="appletPlugIn"
type="application/x-java-applet;version=1.5"/>
causes FireFox to ignore my provided JRE and go directly to Sun where it currently obtains JRE version 6.
It just seems weird that behavior to match IE cannot be obtained using just this tag without additional javascripting involved. Otherwise, what's the point? :)
Thanks!
# 5
I find the whole support for both tags lacking. Below is what I use, and it seems to work in IE and FireFox to define a minimum of 1.4.1 but point to 1.5.0_11 if needed. The "classid" and "type" are important.
<object id="cc" name="cc" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab#Version=1,4,1" width="400" height="150" align="baseline">
<PARAM NAME="type"VALUE="application/x-java-applet;version=1.4.1">
<PARAM NAME="code" VALUE="class">
<PARAM NAME="codebase" VALUE="codebase">
<PARAM NAME="archive"VALUE="cc.jar,tour.jar">
<PARAM NAME="cache_option" VALUE="Plugin">
<PARAM NAME="cache_archive" VALUE="cc.jar">
<PARAM NAME="scriptable"VALUE="true">
<PARAM NAME="mayscript"VALUE="true">
...
<embed id="cc" name="cc" width="400" height="150"
align="baseline"
type="application/x-java-applet;version=1.4.1"
code="classname"
codebase="codebase"
archive="cc.jar,tour.jar"
cache_option="Plugin"
cache_archive="cc.jar"
scriptable="true"
mayscript="true"
pluginspage="http://www.java.com/en/download/manual.jsp">
