Jump to content

<object> and <embed>


Jack McKalling

Recommended Posts

... or if you want... use a javascript, where if it's IE it will use the embed tag, if other browser use the object tag. If u wana give this a go, take it easy if it plays up as I'm new to javascript, but do this on a test page if ya want:place this javascript where you want the object to appear:

<script type="text/javascript">  <!--  if (is_ie3up)   {  var object=('<embed src=\"movie.wmv\"></embed>')  }  else  {  var object=('')  }  //-->  </script>

now place your object html underneath or above that javascript... change the src= in the javascript, and add any attributes i.e. width, height e.t.c. but remember if you put a " in javascript it has to be backslashed \" and the same goes for / forward slases \/dont blame me if it doesnt work... and IF it doesn't, put them both into the document.just trying to keep valid markup here and practise newly found javascript skills.

Link to comment
Share on other sites

  • 3 months later...

You would want the opposite, right? Only IE Windows uses the object with classid and codebase parameters. All other browsers use the non-standard <embed>.Using <object> to play movies on any Mac browser doesn't work, unless you give up using all possible control. In other words, plain vanilla QuickTime will play using the <object> properly, but if you want to include the VR controller for a QT VR file, for example, there's no valid way to do it.There is an article here on this site that discusses this matter, but has many inaccuracies. For example, this page http://www.w3schools.com/media/media_quicktime.aspwhen discussing the <embed> element, says it is used in browsers that don't understand <object>. That is simply not true. It is used by browsers that don't need the ActiveX component of the <object> code as it is displayed in the example.And the browser that does display the media, IE for Windows, doesn't properly implement the <object> element in the first place!! The codebase and classid attributes are for ActiveX (used ONLY in IE Windows).What browsers don't need the ActiveX control? Any browser that ISN'T IE Windows...(yes, that means even IE Mac doesn't need this code and will properly use <embed>).The problem is that the <embed> tag isn't valid XHTML; in fact, the w3c never officially recognized <embed>, yet it is RECOMMENDED by Apple for QuickTime, is included in the auto-generated HTML pages to contain Flash, and other media plug-ins recommend it with a series of attributes to use to get at the plug-in's unique capabilities. It is also prescribed for use (nested in the <object>) for QuickTime, RealPlayer, and WindowsMediaPlayer in Steve Mack's "Streaming Media Bible," for QuickTime in "QuickTime for the Web," 3rd Ed., and countless others.While one can argue that the books I just mentioned are both over 2 years old, there still isn't a better solution for ensuring that most browsers in use can render the content properly.Why the w3c has never offcially recognized <embed> has never revealed itself to me, therefore, I consider my pages, and those developed by the team working under me, as valid, just as long as the media performs as intended on the major browsers that we support. This site recommends using <object> only (http://www.w3schools.com/media/media_object.asp), and none of the examples work in any browser I tested that wasn't IE for Windows, except 'Picture as Object." When given the choice, I would rather fail the Valid XHTML Strict test than lose the browsing population using Macs and IE browsers other than the 'least standards compliant champion:' IE Windows.These examples all failed using: Firefox 1.5 (Mac/WinXP), Safari 2.0.3 (Mac only) and IE 5.2 (Mac).I think a much better evaluation of the situation can be found here: http://realdev1.realise.com/rossa/rendertest/quicktime.htmlIf anyone has better information, I would be happy to know about it.--------------------------------------------------------------------------

... or if you want... use a javascript, where if it's IE it will use the embed tag, if other browser use the object tag. If u wana give this a go, take it easy if it plays up as I'm new to javascript, but do this on a test page if ya want:place this javascript where you want the object to appear:
<script type="text/javascript">  <!--  if (is_ie3up)   {  var object=('<embed src=\"movie.wmv\"></embed>')  }  else  {  var object=('')  }  //-->  </script>

now place your object html underneath or above that javascript... change the src= in the javascript, and add any attributes i.e. width, height e.t.c. but remember if you put a " in javascript it has to be backslashed \" and the same goes for / forward slases \/dont blame me if it doesnt work... and IF it doesn't, put them both into the document.just trying to keep valid markup here and practise newly found javascript skills.

Link to comment
Share on other sites

"veeeery old browsers" has nothing to do with it. Firefox 1.5 (Mac/Win), Safari 2.0.3 (Mac), IE Mac 5.2, all modern browsers, none work with <object> only; all work fine when using <embed> (or the nested <object>...<embed></embed></object>)Of course, the 'GOTCHA" is code that doesn't validate XHTML strict, but it's better than catering only to IE Windows!!

It's quite simple; use object, and embed as well if you want veeeery old browsers to work and don't mind making your document invalid.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...