drupal: inserting flash content (youtube videos) fails to display in IE

One of the drupal web sites I work on had a problem where any youtube video that was posted to the site failed to display on internet explorer. Any other browser worked fine.

The code we were trying to insert was this:

<object height="350" width="425" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
 classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param name="src" value="http://www.youtube.com/v/l0aVaRrBYQE" />
<embed height="350" width="425" src="http://www.youtube.com/v/l0aVaRrBYQE" type="application/x-shockwave-flash">
</embed>
</object>

One of the mystifying parts of it all was that if you just used that code in a HTML page all by itself, IE could display the youtube video fine. So drupal was doing something mysterious that changed things.

It turns out that for *some reason*, drupal's default HTML filter, even when configured to allow object and param tags would munge the classid attribute slightly, changing it from

classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"

to

classid="d27cdb6e-ae6d-11cf-96b8-444553540000"

After many fruitless attempts at stopping this behaviour (hacking tinymce javascript, the tinymce module, the input filter module, etc etc) I fell back on the tried and true behaviour of just working around the problem, which came to:

  1. install wysiwyg filter module
  2. disable the built in html filter and turn on the new wysiwyg filter
  3. configure new filter to remove the classid attribute from object tags entirely. Something like this in the 'allowed tags' textarea: "object[codebase|width|height]". Apparantly IE doesn't even need it.

Comments

I can't be bothered to register with your site (please implement OpenID!) but I wanted to mention the solution I came up with to the issue of clsid being removed from the rendered node.

function phptemplate_preprocess_node(&$variables)
{
$variables['content'] = preg_replace('/classid="(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})"/','classid="clsid:$1"',$variables['content']);
}

I think it's a simpler solution to the one you mentioned of having to install another module (and in my case, IE needed the classid attribute so I couldn't remove it)

Chris Bailey

i have the same problem since..many many days :-( but where can i  add the php code ?i try in many places in Drupal., but it doesn't works thanks for your  precious help :-) christian

Put that code in your theme's template.php file.