Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my embedded YouTube video work in Firefox, but not Internet Explorer?

I'm using the following code to display a YouTube video.

<object width="425" height="344">
    <param name="movie" 
           value="**URL**">
    </param>
    <param name="allowFullScreen" 
           value="true">
    </param>
    <embed src="**URL**" 
           type="application/xshockwave-flash" 
           allowfullscreen="true" 
           width="425"
           height="344">
    </embed>
</object>

It works in Firefox, but why doesn't it in Internet Explorer?

I'm a totally new to web development, so I'm running into all these wonderful inconsistencies that you veterans are used to ;)

like image 931
BeachRunnerFred Avatar asked Sep 24 '09 00:09

BeachRunnerFred


1 Answers

To elucidate, it doesn't work because the object tag is incomplete. Firefox gives up on the object element and uses the fallback old-school embed element instead. IE doesn't support embed so you get nothing.

An object element must at least have a type attribute telling it what plugin to use and a data attribute telling it what to send the plugin. In IE you also need to mirror the data attribute in a <param name="movie"> value inside the object because it runs plugins differently.

IE won't ‘stream’ partially-loaded Flash files this way though. To get that, you have to use an ActiveX classid instead of the type to tell it which plugin to use. If you care about this (and you might not: for small files, stub loaders, and files that are useless until complete, it makes no difference) then you have to start serving combinations of nested objects or embeds, which quickly becomes confusing.

like image 126
bobince Avatar answered Nov 08 '22 23:11

bobince