from http://developer.apple.com/internet/ieembedprep.html

anything else won't work as well.


That's only true for static content.  Dynamically, you can skip the
embed tag on IE and the object tag on everything else.

Aaron, I think your script errors are probably from the closing
'</object>' tag.  You need to be careful including closing tags in
javascript.  Always break them up like this:  '</ob'+'ject'+'>' or the
parser will barf.

Your script is also IE only since there is not embed logic but I
presume that is because you are debugging IE.

Anyway, as an example of how to make this work here is a 'getMovie' function:

function getMovie(movie, w, h) {
   var o, a=[];
   var params = {
       src: movie,
       bgColor: '#ffffff',
       autoplay: 'false'
   };

   if (jQuery.browser.msie) {
       a.push('<object width="'+w+'" height="'+h+'"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
       
a.push('codebase="http://www.apple.com/qtactivex/qtplugin.cab";></ob'+'ject'+'>');
       var o = document.createElement(a.join(''));
       for (var key in params)
           o.appendChild(document.createElement('<param
name="'+key+'" value="'+params[key]+'">'));
   }
   else {
       a.push('<embed width="'+w+'" height="'+h+'" style="display:block" ');
       a.push('pluginspage="http://www.apple.com/quicktime/download/"; ');
       for (var key in params)
           a.push(key + '="'+params[key]+'" ');
       a.push('></em'+'bed'+'>');
       o = a.join('');
   }
   return o;
};


To avoid the "click to activate" message this function must be in an
external file, like:

<script src="get.movie.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
   $('body').append(getMovie('myMovie.mov',500,500);
});
</script>

Mike

Reply via email to