You are here: Reference > JavaScript > client-side > HTML DOM > properties > classid (object)

classId property | classid property (object)

Browser support:
classId
classid
Sets or retrieves the class identifier of the embedded application.
A class identifier is a unique registry-identifying component that is used to identify an ActiveX control.

Syntax:

object.classId;
object.classid;
You can find the related objects in the Supported by objects section below.
classId: This property is read/write.
classid: This property is read/write.
HTML page for this property: classid

Possible values:

String that sets or retrieves the class identifier for the object.
It can be a clsid, or an URL of a file (Java applet, Python file, ...).
The URL can be an absolute or relative path as well. If a relative path is used and the codeBase property of the object is specified, then the relative path is relative to the value of this property, else the relative path is relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the classid attribute to embed Java applet. Only Internet Explorer supports the clsid in the classid attribute.
Code
HelloWorld.java
<object classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA" width="300px" height="100px" 
    codebase="http://java.sun.com/products/plugin/autodl/jinstall">
    <param name="type" value="application/x-java-applet" /> <!-- Opera, Google Chrome and Safari use the type parameter, instead of the clsid -->
    <param name="code" value="HelloWorld.class" />
    <param name="codebase" value="/external/examples/common/java/" />

        <!-- Firefox needs codetype, classid pair in the following form -->
    <object codetype="application/x-java-applet" classid="java:HelloWorld" width="300px" height="100px">
        <param name="codebase" value="/external/examples/common/java/" />
            Your browser does not know how to execute Java applications.
    </object>
</object>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the classid attribute with Macromedia Flash Player.
It clearly focuses on cross-browser support only, and it isn’t standards-compliant, but there isn't any standards-compliant cross-browser way to embed a Flash application into a document with Flash Player detection.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="120" 
        codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0">
    <param name="movie" value="flash.swf" />
    <!-- Optional params -->
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="quality" value="high" />
    <!-- END Optional -->
    <embed src="flash.swf" width="300" height="120" play="true" 
        loop="true" quality="high" 
        pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> 
</object>
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of the classid property with Windows Media Player:
Code
HelloWorld.java
<head>
    <script type="text/javascript">
        function GetClassId () {
            var object = document.getElementById ("myObject");
            var classid = null;

            if ('classid' in object) {
                    // Internet Explorer
                classid = object.classid;
            }
            else {
                if ('classId' in object) {
                        // Opera
                    classid = object.classId;
                }
                else {
                    classid = object.getAttribute ("classid");
                }
            }

            alert (classid);
        }
    </script>
</head>
<body>
    <object id="myObject" classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA" width="300px" height="100px"
            codebase="http://java.sun.com/products/plugin/autodl/jinstall">
        <param name="type" value="application/x-java-applet" /> <!-- Opera, Google Chrome and Safari use the type parameter, instead of the clsid -->
        <param name="code" value="HelloWorld.class" />
        <param name="codebase" value="/external/examples/common/java/" />

            <!-- Firefox needs codetype, classid pair in the following form -->
        <object codetype="application/x-java-applet" classid="java:HelloWorld" width="300px" height="100px">
            <param name="codebase" value="/external/examples/common/java/" />
                Your browser does not know how to execute Java applications.
        </object>
    </object>

    <button onclick="GetClassId ();">Get classid!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content