Dynamically Embedding Flash in Firefox 3

Why is it that, at each new turn, you hardly add new features before somebody breaks one of your old features? Today I noticed that Guise™ file upload and sound was not working on Firefox 3. Guise has for a long time been adding a small Flash plugin in the background using the <object> element, intelligently using the Flash MIME type of application/x-shockwave-flash for Firefox or its class ID of clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 on IE. This had been working smoothly until Firefox 3 came along.

Firefox 3 refuses to load the Flash plugin dynamically using the <object> element. Firefox 3 will, however, load Flash using the <embed> element—which isn't supported in XHTML, which Guise uses in all its pages. For a moment I thought about simply over to the new swfobject library, which promises to take care of all these issues, but according to the swfobject documentation, swfobject won't work with the application/xhtml+xml MIME type, even though this is the MIME type that is supposed to be used with XHTML (which all the swfobject examples use).

So for the moment I've changed Guise to dynamically insert an <embed> element only on Firefox 3 just to get Flash working again. Of course this also means updating the Guise XHTML DTD to accept <embed>. Eventually I'll probably just ditch the DTD altogether, following HTML 5.