[thelist] Using <object> for java applet

Benjamin Hawkes-Lewis bhawkeslewis at googlemail.com
Tue Dec 16 04:55:43 CST 2008


Bill Moseley wrote:
> I'm working on a page that uses this file upload applet:
> 
>     http://www.javaatwork.com/java-upload-applet/install.html
> 
> But the page is xhtml and I believe I should be using <object>.

Note that XHTML Transitional and XHTML Frameset both include "applet".

Switching may not be easy.

> I'm finding sometimes the applet (using the <applet> tag) will load
> in Firefox but not in IE.

Curious.

> I'm curious is this is the current recommended approach to include a
> java applet:
> 
>     http://ww2.cs.fsu.edu/~steele/XHTML/appletObject.html

That's what Mozilla recommend:

http://tinyurl.com/6p93nt

It's also worth reading what Sun have to say:

http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/contents.html

http://java.sun.com/products/plugin/versions.html

especially:

http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/using_tags.html

I'd follow Mozilla's recommendations for non-IE browsers over the crazed 
markup suggested by Sun (<comment> WTF?) but the Sun recommendations are 
still required background reading especially for IE.

> Specifically, the "XHTML (using object tag)" shown at the bottom.
> 
> Also, you might note that the <apple> example from the first link
> has a "codebase" and then relative archives:
> 
>     archive="myuploader-free-signed-v161.jar, labels.jar"
> 
> What I'm doing instead is using *not* using the codebase and instead
> using full urls for the two jar files.  Can I do that also with
> <object>?

Dunno. According to the HTML4 spec, the "codebase" attribute specifies a 
base URI for other attributes, but the "archive" attribute may include 
relative or absolute URIs.

Note also that according to the spec, whereas the "archive" attribute of 
"applet" is comma separated, the "archive" attribute of "object" is 
space separated:

http://www.w3.org/TR/html401/struct/objects.html#edef-APPLET

http://www.w3.org/TR/html401/struct/objects.html#edef-OBJECT

Also note that in Internet Explorer's implementation of OBJECT and 
APPLET, "codebase" is used as a URL from which to download a required 
plugin rather than a base URI for other attributes:

http://msdn.microsoft.com/en-us/library/ms533576.aspx

while "archive" is ignored:

http://msdn.microsoft.com/en-us/library/ms533081(VS.85).aspx

--
Benjamin Hawkes-Lewis





More information about the thelist mailing list