Home arrow HTML arrow Page 2 - Sample Chapter: HTML 4.01 Programmers Reference

Sample Chapter: HTML 4.01 Programmers Reference

In this article we will look at a sample chapter from Wrox's HTML 4.01 Programmer's Reference book. This chapter focuses on the HTML object tag and shows a variety of advanced ways to use and manipulate it.

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 10
July 24, 2002
  1. · Sample Chapter: HTML 4.01 Programmers Reference
  2. · The Object Tag Explained
  3. · How the
  4. · Page 4
  5. · Internet Explorer
  6. · Using the
  7. · Hidden Image Elements
  8. · Inserting a Java Applet with the Object Element
  9. · Inserting a Flash Animation with the Object Element
  10. · Conclusion

print this article

Sample Chapter: HTML 4.01 Programmers Reference - The Object Tag Explained
(Page 2 of 10 )

While what we've looked at in HTML so far, such as links, tables, and forms, offers a lot of important functionality, there are still many things that can't be achieved with just HTML alone. What happens if we want a movie embedded in our web page, or an audio MP3 file? In the first days of the web, we could do little more than browse hyper-linked text pages with the very occasional image if we were lucky. With HTML 2.0, we could only insert images, videos, sounds, and text. This improved further with HTML 3.2, but to add anything more, such as simple animated messages, spreadsheets, word documents, or even full 3D renderings of landscapes, we needed to insert them as objects.

HTML 4.01 allows for this by making the <object> element the standard way of doing this. Previously, the placement of objects in web pages was supported in a mish-mash of standard and non-standard ways. Indeed, the <object> element supercedes the <applet>, <embed>, and <img> elements, as well as Microsoft's <bgsound> element and dynasrc attribute. The <object> element is mainly used for content types the browser can't handle itself, and therefore an <object> element needs to provide both the data to be displayed and the plug-in that handles the display of the data. <object>, in theory, provides a single way to embed a whole range of objects into web documents, and offer more universal, cross-platform support for HTML pages.

However, a major source of disappointment is that the <object> element, despite being the standard way of doing this, was until recently, only really available in Internet Explorer. This is because the plug-ins needed to support many objects are not often universally cross-platform compatible. Netscape 6 goes part of the way to rectifying this, by adding support. Despite this, though, in the early versions of Netscape 6 (6.0 and 6.01), support for the <object> element when adding anything other than images, was erratic verging on non-existent at times. However, in the more up-to-date Mozilla milestone builds (0.8 and beyond, which form the basis for future Netscape releases), many of these problems have been resolved, and <object> will therefore work properly in the next major upgrade to Netscape 6 expected in summer 2001. Also, other browsers such as Opera 5, and older browsers like Netscape 4 still have limited support for this element and rely entirely on the old <embed> element to enable components.

In this chapter we will be focusing on the <object> element, as the other elements (except for <img>) have either been deprecated, and are covered in Chapter 15, or in the case of the <embed> and <bgsound> elements, were never part of the standard. Both of these elements are covered in Chapter 16.

The <object> Element History
Originally, the HTML 2.0 Standard provided only one method for incorporating media into HTML documents: the <img> element. This element has certainly proved worthwhile, but it is, of course, restricted to image media, which means that its usefulness is limited as richer media find their way onto the Web. For other media though, there was the <embed> element, which was introduced in Netscape 2 and IE 3, and is still in many browsers the only way to insert many types of objects into web pages. With the introduction of Java, the <applet> element was introduced in HTML 3.2, to allow developers to insert Java applets.

The <object> element was originally introduced by Microsoft in Internet Explorer 3 for the inclusion of Microsoft Component Object Model or COM objects (such as ActiveX Controls and a wide variety of different media types and plug-ins). Internet Explorer introduced this tag with support for ActiveX controls, and Microsoft has continued to develop around it.

When Microsoft released its first set of Internet tools in March 1996, it announced ActiveX technology which in all truth was just a new marketing name for its existing OLE technology. ActiveX (or 3rd generation OLE technology) was a framework that allowed software components to cooperate even if they had been written by different vendors, at different times using different tools and different languages, and if the objects were located in the same process same machine or distributed over multiple machines. Some ActiveX controls came with the IE browser.

The reason the <object> element has proved so popular with the HTML W3C standards body, and was ultimately adopted by it, was that it introduces a uniform way to embed all kinds of object images, Java applets, movies, etc. We can't use the <embed> tag to place images or Java applets, and we can't use the <img> element for anything other than images, yet the logic behind introducing this content is very similar for each type of object. For each object, regardless of whether it's a graphic, a Java applet, or a RealTime movie, we still need to state the location of the object, the type of object we are including, and a place to download a "helper application" so that the browser can still invoke the object, even if it doesn't have native support for it.

A helper application is one that needs to be downloaded by the browser before it can run a particular object. For instance with some browsers need to download Macromedia's Flash before they can run a Flash animation.

Arguably, the <embed> element handles all of these features as well and could have been adapted to handle images and Java applets; however, the <object> element, together with the param attribute provides a cleaner and more general approach to passing parameters to the component, and that may have been what tipped the scales in its favor.

It's an attractive solution, if a somewhat flawed one in some ways. One problem was that Netscape 4 didn't support the <object> element Netscape still preferred to use the <embed> element, which was never officially recognized, but as previously mentioned, <object> has been introduced in Netscape 6 and Opera 5, albeit to a limited extent. There is also the problem that several components created by Microsoft only ship with Internet Explorer, and are therefore only available with Internet Explorer, such as the graphic effects filters. In general, it is possible to add a lot of other third-party components with <object> in Netscape 6, such as images and applets, and it is possible to include images in Opera 5. However, at this precise moment in time, the <object> element is not an entirely cross-browser solution.
blog comments powered by Disqus

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials