Advertisement

Important attributes HTML <object> tag

archive attribute

Because performance reasons, you can select pre-downloaded file contains one or more objects in the collection. Java-based applications is especially so, in these applications, a Java class will depend on many other classes to complete its work.

Value archive attribute is a list of URL with quotes, where each URL points to a profile before displaying or performing the Object Browser to load.

classid attribute

Classid attribute specifies the location of the object contained in the browser, usually a Java class.

Its value is an absolute or relative URL of the object. If a codebase attributes, the relative URL is relative to the codebase attribute specifies the URL terms; otherwise, they are relative to the current document's URL.

For example, to execution time is included in clock.class file Java applet, it may contain the following code in the HTML document:

<object classid="clock.class" ></object>

The browser will look for the code for the applet with the current base URL of the document. Thus, if the current document URL is as follows:

http://www.w3my.com/time.html

The browser will get the code for the applet our clock.class instance at the following addresses:

http://www.w3my.com/clock.class

Tip: classid property is similar to <applet> tag code attribute provides a file name that contains the object.

codebase attribute

codebase attribute is an optional attribute that provides a basic URL. The value of this attribute is a URL, which points to the directory that contains object classid property refers.

codebase URL overrides the base URL of the document, but not permanently replace it. If you do not use the codebase attribute, this base URL is the default value.

Now, that we continue to use the previous example, suppose that a document from http://www.w3my.com, but this clock applet in a separate directory named classes of. By specifying classid = "classes / clock.class" you can not get this applet. Instead, the codebase attribute and the new base URL included:

<object classid="clock.class" codebase="http://www.w3my.com/classes/" >
</object>

This line statement that resolves to this URL:

http://www.w3my.com/classes/clock.class

Although we use the absolute URL in this case, in fact, you can also use relative URL. For example, applet host and often save the document together on the same server, therefore, is to reposition the reason, specify a relative URL for the codebase, the situation is often better, for example:

<object classid="clock.class" codebase="/classes/" >
</object>

Tip: You can see from the above examples, codebase attribute classid attribute with the use, you can specify the full URL of the object.

codetype property

codetype attribute identifies the code type.

Only the browser can not determine the next applet MIME type, or if the server does not transmit the correct MIME types when downloading an object, the need to use codetype properties as classid attribute.

codetype properties similar type properties. The difference is that it is used to identify the type of program code, and the type attribute is used to identify the type of data file.

The following example to explicitly inform the browser, the object code is Java:

<object codebase="clock.class" codetype="application/java" >
</object>

declare property

declare property can define an object, but also to prevent the browser for download and processing.

When used with the name attribute, this tool is similar to more traditional programming languages ​​some pre-declaration, such a declaration can delay the time to download the object, until the object really been applied in the document.

property data

data property is used to specify the URL object processing for the data file.

The value of this attribute is the URL of the file, the URL may be an absolute URL relative to the document base URL or a relative URL, or a relative URL with the codebase attribute provides an absolute or relative URL.

Browser by inserting into the document object types to determine the type of data.

This property is similar to the <img> tag the src attribute, because it is to download the data processed by the containing object. Of course, the difference between them is that, data attributes allowed to contain almost any type of file, not just image files.