HTML Object Tag Tutorial

The HTML object tag was intended as a generic tag for embedding images, audio, video, Java, Flash, and other objects into a web page.

Because of a lack of browser support it never really caught on as a replacement for the <img> tag and <applet> tag.

And because the major browsers require different codes to load the same object type, a second blow has been dealt against the object element.

The object element does offer a solution. Similar to how the noscript tag shows content between the <noscript> and </noscript> tags if the browser can't execute the script, if an object isn't displayed the code between the <object> and </object> tags will be displayed.

This, however, can lead to an awful lot of extra work trying to include alternative codes for different browsers. Way more work than it's worth, especially if you just want to add images to a web page.

<object data="images/picture.jpg" type="image/jpg">
This is what will show if the image can't be displayed.
</object>

Yeah, that looks easy enough, but try embedding an object where lots of parameters are needed and different codes are required for different browsers.

If you see the ebook cover for Industrial Strength Link Building to the right then your browser is capable of rendering an image as an object using the code shown above. If you see a dopey smile, it isn't, you're seeing the alternative content.

Unless you really need to know about the object element, you're probably much better off sticking with the image element for compatability reasons and ease of use.

Based on your interest in this tutorial, you may also be interested in these related pages:

If you want your web site to rank high in the search engines . . . what are you going to do to get it there? Check out my search engine optmization guide, SEO for YOU: Search Engine Optimization for Ordinary Everyday People!