A small writing piece about the
object element, especially why it is useful. I think lots of people don't even know this is possible with the current state of HTML, 'cause everyone is still using
applet or worse:
embed. The specifications:
object element exists in the HTML specification since version 4. The reason author's didn't use it was a result of it's complexity and the easier alternatives which had already great support in the major browsers. The object
element had however worse support in one major browser (yes, IE). Mark Pilgrim has written an article about that issue about how to solve the problem with
object and IE. You should now this technique relies on using some really ugly hacks.
The advantage of this element opposed to the
img element is that it hasn't have an attribute for alternate text. Because you can "embed" HTML within the element you can make the alternative text much more describing, with for example abbreviations and hyperlinks within it. This way it is also possible to specify one language for the alternative text and one for the title attribute, which I miss sometimes in the
A second advantage is that you can include another
object element within a
object element. With nested objects you could first try to send the user a Flash movie, if that doesn't work they will get an SVG and if that doesn't work a nice PNG. And if all that may fail (it will in IE) the user gets nice formatted (markupped) plain text.
In XHTML2.0 this will be the only element specific meant for including external information like markup languages or different images. You could also use the embedding attribute collection for images and or graphics but the
object element serves a more general purpose and can be used for more things. In my opinion it is not "evil" that XHTML 2.0 introduces problems with backwards compatibility. It has to change sometimes :).
IE 5.2 Mac seems to have no trouble with this use of the
<object> element (at least in my humble experiments).
Perhaps IE for Windoze may be different, but there are limits to my patience.
I tried this quite recently, too. I found it was OK in Safari, as well - except that when I turned off the images the embedded text didn't display. It also worked in Camino - except that I found I didn't get the correct context menu for the image.
Thanks for pointing that out Jacques, I should (and will) treat the Mac and Windows versions as completely different. If only the Windows developer team had a guy like Tantek Çelik.
Internet Explorer's poor implementation of the
object element is a continuous source of frustration to me. Techniques such as 'Flash Satay' would not be necessary if it weren't for IE.
Ironically, I find myself in the same position with IE/Win now as I did with Netscape Navigator 4.x a couple of years ago. I don't really care about NN4 users anymore (they get content with no frills), but I HAVE to care about IE users.