IE7, IE8 Beta2… meet <object/>

Why is it that IE7 and IE8 Beta 2 still can’t quit get the <object/> tag correct? When using Javascript to “dynamically” add object tags to the interface my experience, bad luck, and bouts of pain teach me that using the DOM API just doesn’t cut it. Well, to be fair the following functions don’t cut it:

  • document.createElement
  • document.createAttribute
  • [DOMElement].setAttribute(key, value)
  • [DOMElement].setAttributeNode([DOMAttribute])

For any and all other “dynamic” HTML modifications the above functions work great! But if I use them to embed Flash or Silverlight movies it just tanks. Instead you have to construct ugly strings that represent the HTML you want and use [DOMElement].innerHTML. When you do this, suddenly the .swf/.xap loads and all is well.

Why oh why?

And for anyone who cares, following file does a decent job of HTML generation within Javascript… except for IE and the <object/> tag…. and input of type radio (WTF!).

http://cowarthill.com/blog/wp-content/uploads/2008/11/html_obj.js

Silverlight vs. Flash

I’ve been a long time hater of Flash as a web-service consumer because of its inability to use any HTTP method other than GET or POST. People revert to stupid URL argument tricks like ?_method=DELETE and actually use a GET or POST, neither of which work if your service layer is actually … truly … RESTful.

Silverlight has the same damn issue. Apparently none of the blog posts I read a WHILE back (2+ yrs) mentioned the fact that Flash, and now Silverlight, use the lowest common denominator for their web request classes…. NPAPI (Gecko/Mozilla Plugin SDK). I’m sure there are good reasons for using the embedded ones, security, re-usability, performance too – but it’s rather annoying!

Why the NPAPI developers don’t augment the API, I have no idea. But at least Silverlight allows for a HTML event to trigger the OpenFileDialog.ShowDialog() without having to do fun invisible overlays.

Silverlight:
http://wilcob.com/Wilco/Silverlight/http-requests-in-silverlight.aspx

Flash:

http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head34

http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html
http://theflashblog.com/?p=423