July 12, 2004


The good folks over at the W3C are writing a two-part article for the Web Standards Project about the object element and how to use it. In a nutshell, the object element was intended as a multi-purpose tag for embedding multimedia content. This includes, but is not limited to, images, sounds, movies, applets, external files, etc. Unfortunately, poor browser support has long been the bane of developers everywhere.

My latest experiment in web design shows you how to tame the object in Internet Explorer without resorting to kludgy hacks and junk markup. With just one stylesheet rule and an HTC file, you can say goodbye to <img> tags for good.

Posted by jon at July 12, 2004 7:10 AM


Cool beans yo. Looks really slick. Two things though,

1) You mention that using a JS file to change the objects around would be to slow. Isn't that *exactly* what a HTC file is - an IE specific JS file? I mean, you delete and replace instead of modifying, but it's still just JS.

2) You use a conditional css hack to make IE see the style sheet - I don't like this method because it does invalidate the CSS, I would suggest the all handy (and validating) use of conditional statements for ie in the form of:

<!--[if gte IE 5]>
<style>behavior: object.htc</style>
<![end if]-->

Again, cool idea.

Posted by: Jeff Minard at July 12, 2004 9:52 AM

I suppose I should go back and clarify the article a bit...

1) You are exactly right about HTC vs. JavaScript. The point I was making wasn't that it would necessarily load the styles or alter the DOM any quicker; rather, once it was changed, the page would respond more quickly if you scroll up or down. This is very apparent if you compare the normal object page ( http://code.jenseng.com/object/objects.html ) and the replaced object page ( http://code.jenseng.com/object/objects_ie.html ) on a slow machine.

2) As for the CSS, while it is technically an impossible selector given the (X)HTML namespace, it is valid CSS (and it does in fact validate) since it is syntactically correct (unlike other hacks, such as the underscore hack).

Posted by: jon at July 12, 2004 10:20 AM
Post a comment

Remember personal info?