HTML and CSS Reference
In-Depth Information
Replace applet with object
Change all
applet
elements to
object
elements.
Code View:
<applet code="com.example.Bullseye" codebase="/applets"
width="100" height="100" align="left"
alt="Bullseye!" name="bullseye">
<param name="rings" value="8" />
<param name="outer" value="red" />
<param name="inner" value="white" />
<p>Bullseye!</p>
</applet>
<object code="com.example.Bullseye" codebase="/applets"
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase="http://java.sun.com/products/plugin/1.4/jinstall-
14-win32.cab#Version=1,4,0,mn"
width="100" height="100" align="left"
alt="Bullseye!" name="bullseye">
<param name="codebase" value="/applets" />
<param name="rings" value="8" />
<param name="rings" value="8" />
<param name="outer" value="red" />
<param name="inner" value="white" />
<p>Bullseye!</p>
</object>
Motivation
XHTML strict does not allow
applet
. Instead, it uses the
object
element. The
applet
element was removed
because it only handles Java applets, not Flash, PDF, HTML, QuickTime, or many other formats authors want to
insert in web pages. The
object
element is simply more generically useful.
In some browsers, the
applet
element is handled by an outdated Java virtual machine bundled with the
browser. However, the
object
element is handled by the more up-to-date virtual machine in the Java plug-in.
Furthermore, the
object
element allows for near-automatic installation of the current version of Java, whereas
the
applet
element does not.
Potential Trade-offs
No one object syntax works for all browsers. To work around this you can nest
object
elements inside each
other and use conditional comments to keep Internet Explorer from seeing the second
object
element:
<object width="300" height="300"
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
Search WWH ::
Custom Search