Using the standard OBJECT tag, how can I display a java applet with automatic prompts to install Java and with fallback content?

Posted by CB on Stack Overflow See other posts from Stack Overflow or by CB
Published on 2010-11-08T20:51:42Z Indexed on 2011/01/07 20:53 UTC
Read the original article Hit count: 160

This is the code i'm currently using: (note - %s is replaced on the server side)

<!--[if !IE]>-->
<object
        type="application/x-java-applet"
        width="300" height="300"
>
<!--<![endif]-->
<!--[if IE]>
<object
        classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        codebase="http://java.sun.com/update/1.6.0/jinstall-6u22-windows-i586.cab"
        type="application/x-java-applet"
        width="300" height="300"
>
<!--><!-- <![endif]-->
        <param name="codebase" value="/media/vnc/" >
        <param name="archive" value="TightVncViewer.jar" />
        <param name="code" value="com.tightvnc.vncviewer.VncViewer" />

        <param name="port" value="%s" />
        <param name="Open New Window" value="yes" />
</object>

When Java is installed, this works perfectly in both IE and Firefox. When Java is not installed, IE and Firefox both correctly prompt for an autodownload of Java 1.6 from the codebase line. (IE via the activex url given firefox via the Plugin Finder Service)

Now, suppose I want fallback content to be shown if the plugin isn't installed, say a simple message like "Get Java". From reading the specs, i'd assume this should not change the plugin finding prompt - that is, rendering the fallback should be seen as a failure to render the object tag. Thus, I should still get the plugin finder service prompting me to install Java. Instead, simply adding a single character to the innerHTML of the object element causes Firefox to no longer prompt. Test this by visiting data:text/html,<object type='application/x-java-applet'>Java failed to load</object>.

How can I keep firefox prompting to install Java while providing fallback content?

URL to test Firefox's Java Plugin Finder Service: data:text/html,<object type='application/x-java-applet'/>

© Stack Overflow or respective owner

Related posts about java

Related posts about XHTML