Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
3.  Using OBJECT, EMBED and APPLET Tags in Java Plug-in Introduction Java Plug-in in Internet Explorer on Microsoft Windows Platforms  Previous   Contents   Next 
   
 

Java Plug-in in Netscape Navigator on Microsoft Windows and Linux Platforms or Solaris™ operating environments

To use Java Plug-in in Netscape Navigator™ 4 browsers on Microsoft Windows and Linux platforms or Solaris™ operating environments, use the EMBED tag. The following example maps an APPLET tag to a Java Plug-in EMBED tag:

Original APPLET tag:

<APPLET code="XYZApp.class" codebase="html/" align="baseline"
          width="200" height="200">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
          No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
</APPLET>

New EMBED tag:

<EMBED type="application/x-java-applet;jpi-version=1.4" width="200"
        height="200" align="baseline" code="XYZApp.class"
        codebase="html/" model="models/HyaluronicAcid.xyz"
        pluginspage="http://java.sun.com/jpi/plugin-install.html">
<NOEMBED>
No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
</NOEMBED>
</EMBED>

Note that the EMBED tag contains similar information to the APPLET tag, and it is sufficient to launch Java Plug-in in Netscape Navigator browsers. The attribute type in the EMBED tag is used for identifying the type of the Java programming language executable, such as an applet or a bean. When a Netscape Navigator browser renders this attribute in the EMBED tag, it will try to load Java Plug-in into the browser. By specifying the type attribute, Java Plug-in will know how to initialize the Java programming language executable.

In the above example, several attributes in the EMBED tag, such as width, height and align, map directly from the corresponding attributes in the APPLET tag. These contain formatting information that a Netscape Navigator browser uses to position Java Plug-in. Since this information is mapped directly without changes, the position and appearance of the applets using Java Plug-in should be the same as those applets using the APPLET tag.

Unlike the OBJECT tag, all information must be stored inside the <EMBED> tag instead of using PARAM. Therefore, all attributes and params in the APPLET tag must be mapped as attribute-value pairs inside the EMBED tag.

In the above example, the code and codebase attributes in the APPLET tag are mapped into the EMBED tag attributes. Attribute code identifies the applet. Its value should be the same as the code attribute in the APPLET tag. Attribute codebase identifies the codebase of the applet. Java Plug-in knows where to download the applet or JavaBeans component because it can read this information from the attributes. Also notice that the model attribute within the EMBED tag is mapped from the model param inside the APPLET tag.

Like the codebase attribute in the OBJECT tag, attribute pluginspage in the EMBED tag is used by Netscape Navigator browsers if Java Plug-in is not installed. It should always point to the Java Plug-in Download Page on the Java Software web site.

The text "No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!" in the APPLET tag is mapped inside the <NOEMBED> and </NOEMBED> tags. Originally, this text is displayed only if the browser does not have Java technology support. By mapping it inside the NOEMBED tag, this text will be displayed if the browser does not support the EMBED tag or if the browser fails to start the Java Plug-in.

The APPLET-EMBED tag attributes mapping is as follows:

Attributes

APPLET tag support

EMBED tag support

Attribute map in EMBED tag

ALIGN

X

X

Attribute ALIGN

ALT

X

X

Attribute ALT

ARCHIVE

X

 

Attribute archive

CODE

X

 

Attribute code

CODEBASE

X

 

Attribute codebase

HEIGHT

X

X

Attribute HEIGHT

HSPACE

X

X

Attribute HSPACE

NAME

X

X

Attribute NAME

OBJECT

X

 

Attribute object

TITLE

X

X

Attribute TITLE

VSPACE

X

X

Attribute VSPACE

WIDTH

X

X

Attribute WIDTH

MAYSCRIPT

X

X

Attribute MAYSCRIPT

Some attributes are special to the EMBED tag. These attributes are:

Attribute

Meaning in EMBED tag

Attribute type

If it is an applet, the value should be "application/x-java-applet;jpi-version=1.4" or "application/x-java-applet". If it is a bean, the value should be "application/x-java-bean;jpi-version=1.4" or "application/x-java-bean".

Attribute codebase

Specifies the base URL of the applet. This attribute is optional.

Attribute code

Specifies the name of the Java applet or JavaBeans component. It cannot be used with param object inside the same EMBED tag.

Attribute object

Specifies the name of the serialized Java applet or JavaBeans component. It cannot be used with param code inside the same EMBED tag. This attribute is optional.

Attribute archive

Specifies the name of the Java archive. This attribute is optional.

Attribute pluginspage

It should be a full URL pointing to an HTML page somewhere on the network.

Attribute mayscript

Specifies whether the applet is allowed to access netscape.javascript.JSObject. The value can be either "true" or "false". This attribute is optional.

Similar to the OBJECT tag case, if the original APPLET tag has PARAM type, codebase, code, object, or archive, mapping it to the EMBED tag attribute will cause a problem. To avoid this, Java Plug-in also supports the same new set of attribute names, as follows:

Original Attribute Names

New Attribute Names

code

java_code

codebase

java_codebase

archive

java_archive

object

java_object

type

java_type

You should use these new attribute names only necessary. If both new and original attribute names exist in the same EMBED tag, the value associated with the new attribute name is always used by Java Plug-in to load the applet or bean.

Java Plug-in in Internet Explorer and Netscape Navigator Browsers

The OBJECT tag in Internet Explorer and the EMBED tag in Netscape Navigator browsers allows your HTML page to use Java Plug-in if the HTML page is browsed on Microsoft Windows platforms or Solaris operating environments. However, if the HTML page is on the Internet/intranet, the page is likely to be browsed by both Internet Explorer and Netscape Navigator browsers. You should activate the Java Plug-in if both Netscape Navigator browsers and Internet Explorer will browse the same HTML page. You can do this using the Java Plug-in OBJECT tag, as follows:

Original APPLET tag:

<APPLET code="XYZApp.class" codebase="html/" align="baseline"
          width="200" height="200">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
No Java 2 SDK, Standard Editoin v 1.4 support for APPLET!!
</APPLET>      

New OBJECT tag:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="200" height="200" align="baseline"
codebase="http://java.sun.com/jpi/jinstall-14-win32.cab#Version=1,4,0,mn">
<PARAM NAME="code" VALUE="XYZApp.class">
<PARAM NAME="codebase" VALUE="html/">
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.4">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
<PARAM NAME="scriptable" VALUE="true">
<COMMENT>
<EMBED type="application/x-java-applet;jpi-version=1.4" width="200"
    height="200" align="baseline" code="XYZApp.class" 
    codebase="html/" model="models/HyaluronicAcid.xyz"
    pluginspage="http://java.sun.com/jpi/plugin-install.html">
<NOEMBED>
</COMMENT>
        No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
</NOMEMBED></EMBED>
</OBJECT>

Because Internet Explorer understands the </OBJECT> tag, it will try to launch Java Plug-in. Notice that the <COMMENT> tag is a special HTML tag understood only by Internet Explorer. Internet Explorer ignores test between the <COMMENT> and </COMMENT> tags. In effect, the above tags actually become:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="200" height="200" align="baseline"
codebase="http://java.sun.com/jpi/jinstall-14-win32.cab#Version=1,4,0,mn">
<PARAM NAME="code" VALUE="XYZApp.class">
<PARAM NAME="codebase" VALUE="html/">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.4">
<PARAM NAME="scriptable" VALUE="true">
   No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
</NOEMBED></EMBED>
</OBJECT>

This is identical to the OBJECT tag example outlined above. The </NOEMBED> and </EMBED> and tags are ignored by the OBJECT tag because there are no corresponding <NOEMBED> and <EMBED> tags.

Because Netscape Navigator browsers do not understand the OBJECT and COMMENT tags, they read the above tags as follows:

<EMBED type="application/x-java-applet;jpi-version=1.4" 
    width="200" height="200"
    align="baseline" code="XYZApp.class" codebase="html/"
    model="models/HyaluronicAcid.xyz"
    pluginspage="http://java.sun.com/jpi/plugin-install.html">
<NOEMBED>
    No Java 2 SDK, Standard Edition v 1.4 support for APPLET!!
</NOEMBED>
</EMBED>	

This is identical to the EMBED tag example outlined above. A Netscape Navigator browser ignores tags because they are an HTML extension in an Internet Explorer browser only.

 
 
 
  Previous   Contents   Next