HTML 014 - Object Tags
PDF

The object tags were originally created in order to allow the implementation of many of the different types of files, such as audio, video, flash, pdfs, images, HTML, and so on. The main reason anyone would use the object tags rather than the embed tags for video or audio would be because the embed tags are considered non-standard. On the other hand embed tags are greatly supported. Either way, the object tags were made in order to allow the use of many different types of media.

Usually when you want to use the object tags you will have a couple of attributes. The first one is the type attribute. This attribute defines the type of media that you want to have embedded into your web page. There is also a specific way to tell the browser the type of media as well. One example is shown below:

<object type="video/x-ms-wmv"></object>

When filling out the type attribute you must use the MIME type name. I have created a list of them in the reference pages. The MIME name will begin with a general term of what the media is. In this case we are embedding a video. Then there is the forward slash and the video type. The type above is 'x-ms-wmv', which is Microsoft Windows Media Video.

Now we need the actual file that is going to be put into the page. To do this we will use the data attribute. When defining the data attribute you just enter the URL that you data is at an the browser will retrieve it to put onto your page. Here is the object tags with the data attribute added.

<object type="video/x-ms-wmv" data="http://www.darkscarab.com/animations/videos/martian.wmv" ></object>

Now we have the actual file we are going to use in our web page. There are also some other attributes you can use in the object tag. Some of them are ones we have used before: height, width, align, and border. A couple other ones are the hspace and vspace. These change the horizontal and vertical space around the object. These are defined in pixels.

There are plenty of other attributes that can be used, however they all depend on which type of object you want to embed. I will go through most of them now:

archive:
Used to allow the browser to preload the object being embedded. Only works for certain types of files. Video and Audio are not one of them.
classid:
Usually used for version checking. An example would be with Flash. This can also the the file name when used in conjunction with codebase.
codebase:
This is the base URL of a document being called for with the classid. The URL in this attribute only goes to the file that the document is in.
codetype:
Almost identical to the 'type' attribute. It uses the MIME type of the object being embedded.
name:
Used to define the objects name. Usually only necessary with Javascript or something similar.
tabindex:
Used to create a sequence that tabbing will follow. This is used to change what the default is. When hitting tab you will automatically sent to the object with the lowest tabindex number first.
usemap:
For image maps. This is defined by the name of the image map which follows the # symbol. Example: usemap="#imagemap"

Another part of the object tags are the tags that are put within them. These are the param tags. These tags always have the name attribute and the value attribute. Knowing what to put into the name attribute depends solely on the type of object being embedded. This is because the object that is being embedded must be able to understand what the parameters are saying. In the case of our video we can do something like this:

<object type="video/x-ms-wmv" data="http://www.darkscarab.com/animations/videos/martian.wmv" >
<param name="src" value="http://www.darkscarab.com/animations/videos/martian.wmv">
<param name="autoStart" value="false">
</object>

With this we have repeated the source file and we have set the autoStart parameter, which tells the player whether or not it should autmatically play. I will not list all of the parameters that you can use because the list would be enormous. If you are looking for the possible uses for a certain document type, the best thing to do is search for it on the web. There is a good chance someone has documentation of it.