We had a lot of problems lately with video and the latest install of Firefox (1.5.04). We were using the embed tag to display our video files and it only worked on about half of the desktops with the latest firefox install. After hunting high and low this was the fix that solved the issue. Very timely info, thanks for the fix.
It appears that the ‘show to non-ie’ type of conditional comments were included in Hixies flash example from 2004, Lachlan’s example used a different method.
In fact, if you combine them, you could use two blocks, one for IE 5-6, and one for IE 7 & standards based browsers “like so”:http://alastairc.ac/code/ie_cc_test.html
I’m not sure what the benefit of nesting the objects is? You are effectively showing different HTML to different browsers anyway?
Copy & paste the code below to embed this comment.
andris zageris
for MSJVM people have to use APPLET, otherwise see: embeding “java”:http://ww2.cs.fsu.edu/~steele/XHTML/appletObject.html via conditional comments.
also: nice js plugin “framework”:http://www.knallgrau.at/code/plugin_js
I think the answer is not to get the embed tag added to any HTML specs, but to encourage browser makers to fix the way their browser handles the object tag. (maybe we need a browser plug-in task force?)
Until that happens (and possibly after because of things like the Eolas issue), Javascript is and will be the best way to embed any content that uses a plugin.
elizabeth, this article made my month! man, i’ve been scouring the net for this answer for months now. my ad school friends entered a contest recently and asked me to embed their current.tv flash video on my blog to help get them some votes … and i reluctantly agreed knowing that it would totally ruin my perfectly valid code that i worked so hard to maintain. but your tips helped fix all my issues and now i can go back to being OCD. so thanks!
Copy & paste the code below to embed this comment.
David Leader
I had noticed the Safari/Firefox conflict myself in object param markup and mounted my own examples a few months ago <http://www.q7design.demon.co.uk/QTMovieMarkup> before submitting a report to webkit. As both markups validate with the W3C validator it is not clear to me which style of object markup is correct, as I find the W3C spec. completely incomprehensible. Anyone out there understand it?
Few months ago I published similar way how correctly insert a Flash into XHTML (see http://www.dgx.cz/trine/item/how-to-correctly-insert-a-flash-into-xhtml). This method doesn’t require to insert any twice!
I have found out the same trick with conditional comments as Lachlan Hunt figured out, syntax-highlighed explanation is here http://www.dgx.cz/trine/item/the-magic-with-conditional-comments.
Copy & paste the code below to embed this comment.
Neil Smith
The parameter for src and controller used in the example are from WMP6.4 rather than WMP7 and later :
From WMP version 7 there was a compatibility layer put into the player to allow these elements temporarily, but it’s not guaranteed to work forever.
The src one is easy to change, it should be name=“url” instead of name=“src”. The param element for controller no longer exists, it’s replaced by uimode : One of
See these MSDN articles for complete details :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playeruimode.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/paramtags.asp
A detailed object comparison between WMP6.4 and WMP 7 and later
Copy & paste the code below to embed this comment.
Chris Latham
If you’re looking to use QuickTime objects, I found a simple solution that uses no JavaScript or nested objects.
Elizabeth pointed out that classid is the piece of code that gives Web standards do-gooders such headaches. So, why not a little server-side if/else statement to show it to browsers that need it?
If the browser is IE, show an opening object tag that includes the classid.
Copy & paste the code below to embed this comment.
Justin Reid
This is great. I’m wondering if we can modify it so that it doesn’t use the IE conditional in the HTML. Try adding a class (“outterObject” in this example) to the parent object, and this to the global CSS file:
Unfortunately, IE doesn’t seem to see the nested object tag as nested, otherwise you wouldn’t need to set the default height and width values to 0 for object tags.
This of course means that you have to remove the height and width from inline on the object to the style sheet, which is a good thing, since it’s a display property anyway (and it will enable you to modify it for other media types).
I’ve only tested this for Firefox and IE6 on the PC, so I’d love to hear any feedback.
A possible word of caution here: From my experience with the Flash Satay method to embed Flash movies into pages, using the <object> tag causes browsers to download the Flash movie completely before playing it, instead of being able to begin playing the movie as soon as enough of the content has been streamed in. I noticed a pause before the movie started playback in the article example… perhaps due to the same reason? All I know is that for Flash movies, with <embed>, content seems to be able to be streamed, whereas with <object>, the entire object must be downloaded before playback can begin.
In my own personal projects and in design work that I do for my clients, I tend to try to use Flash Satay as much as possible, but only when the Flash content is inconsequential to the main “meat” of the page, and is just acting as visual “icing on the cake.” When my clients demand heavy Flash content, I still have to resort to the twice-cooked method for any kind of streaming to occur. (Preloaders don’t seem to be able to counteract this effect, either.) Anyone else have any experience with regard to this?
Test – valid form, Huf/Johansson: (note: IE6, IE5 should show nothing, all other browsers should show a result)
I am
<!—[if gt IE 6]><!—>
either a non-IE/Win browser, or IE/Win >6, or ancient.
<!—<![endif]—>
—
The test for IE versions can of course be reversed by changing the conditional test from gt to lt.
Note that this technique will fail for ancient IE/Win browsers <=IE4/Win.
Copy & paste the code below to embed this comment.
Cecil Ward
And that too. At this point, I give up. I am indeed an idiot. And I am now going to go off and do something else instead like get some coffee, take the dogs out for a walk and feed the hens and ducks.
That commenting works great. In particular, one could use:
<!—[if IE gte IE 7]> <!—>
as the new initial comment just before the nested object. This limits the comments’ effect to only IE 5, 5.5, and 6 (assuming it fails in IE4, I did not test it :) and lets IE7 work properly on its own (ignoring the second object element that it does not understand).
Copy & paste the code below to embed this comment.
Chris Botman
This article got me playing with Flash again, and I noticed an oddity in Firefox; the browser appears to rely on page stying to display Flash movies when only the object tag is used.
If you exclude the width and height attributes from the object tag, the movie won’t appear at all (I guess it can’t read the movie’s intrinsic values). But, even when you do set the width and height, if you turn styles off (View > Page Style > No Style), the movie will vanish.
The embed tag doesn’t suffer from this quirk, not that I’m condoning its use—but I don’t see a workaround.
Copy & paste the code below to embed this comment.
Chris Botman
Just as an addendum, I’m also using the IE conditional commenting to send a unique object tag to IE and a generic tag to other browsers. I’m not nesting my object tags though, it’s literally:
<!—[if IE]>
<object />
<![endif]—>
<!—[if !IE]>—>
<object />
<!—<![endif]—>
I’m not worried about the minor code repetition, and because the offending IE object tag is entirely commented out, the page validates.
Copy & paste the code below to embed this comment.
Cecil Ward
In my earlier post, I mentioned “the Huf/Johansson technique”:url:http://www.alistapart.com/comments/byebyeembed?page=3#25 for IE-Win v.x selective exclusion using valid IE-conditional directives.
I’ve done some testing using “BrowserCam”:url:http://www.browsercam.com and the technique seems very reliable. I use this technique for CSS filtering (but with additional IE/Mac filtering on top), and it’s fantastic. For the benefit of anyone who wants to use know whether they can safely take advantage of this, here’s the browsercam blitz in full.
Tested and passed in: IE5.0/Win, IE 6, IE 7 beta3; Netscape 6.2.3, Netscape 7.2; Konqueror 3.4; IE/Mac 5.2.x; Safari 1.2, Safari 2.0; Camino 1.0; Opera 9.0; Mozilla 1.6; Mozilla 1.7.12; Firefox 1.5
Tested in: Netscape 4.78; IE/Win 4.0 – ‘correct’ behaviour as per spec, ie filter not effective
Test omissions; IE/Win 3; IE/Win 5.5; IE/Mac 5.1.x; IE/Mac<=4.x; Opera<=8.x
Copy & paste the code below to embed this comment.
M. S.
Great article and method. However, as all my pages are XHTML Strict, this won’t validate with W3C. Also, it angers some Web Content Accessibility Guidelines.
I know that within an XHTML document it is proper to type tags in lowercase but I believe that when referring to a tag (or attribute) within an article it is perfectly fine to render them in all caps. Thus . . .
“The use of embed has gone on too long.”
would be perfectly valid as
“The use of EMBED has gone on too long.”
It really helps readability for me when I am reading an article such as this. Looking forward to the sixth edition of your book, Elizabeth. Actually checked Barnes and Noble for it yesterday.
We are developing a filter to allow members to more easily publish youtube and other videos into our global social network. Without altering and breaking the rest of the site layout of course. This article helps considerably! Our core platform is Drupal and we plan to publish back the results once completed.
through trial and error, i came up with the quicktime version ages ago for my day job’s virtual tours section http://www.salford.ac.uk/about/virtual_tour/
Great article but the whole object-in-an-object markup concept is just plain bad to me, and smells of the ol’ embed solution of olden days. Ive got a much simpler solution that works cross-browser and is xhtml compliant. Mine uses two object tag sets and display:none to hide one set based on the browser. One for IE active x and the other for all the others. Some special fixes as well, but uses simple CSS to show and hide each type for each browser. Works on MAC as well (IE and Safari), and works with Flash, Quicktime and any multimedia object you may have. Can even be used as a replacfement for the old iframe. Check it out when you get a chance and send comments:
Copy & paste the code below to embed this comment.
J. L
The following properties are supported for use with the name attribute of the PARAM element. “Param tags”:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/paramtags.asp All these work with IE and Media Player ActiveX plugin (the object with classid). Don’t use old deprecated Media Player 6.4 properties with Active-X plugin.
In Parentheses is specified what you should use with NPAPI-plugin ie. in second object or embed for Firefox, Opera, Safari etc.
Note also that according to specs autoStart is true by default so it is not necessary to specify it.
autoStart (OK, use 0 or 1 instead of false and true(default))
balance—-
baseURL—-
captioningID—- (Mozilla bug 293616)
currentPosition (Only works with local files or if the file is cached)
currentMarker (OK)
defaultFrame (OK)
enableContextMenu (OK, use 0 or 1 instead of false and true(default))
enabled (OK, use 0 or 1 instead of false and true(default))
fullScreen—-
invokeURLs (OK, use 0 or 1 instead of false and true(default))
mute (OK, use 0 or 1 instead of false(default) and true)
playCount (OK)
rate (OK)
SAMIFileName (OK)
SAMILang ?
SAMIStyle ?
stretchToFit—-
uiMode—- (none = set ShowControls to 0), (mini = set ShowPositionControls to 0), (full(default) set ShowStatusBar to 1)
URL—- (Use fileName)
volume—-
windowlessVideo—-
—- = Not supported in browsers(Firefox, Opera, Safari etc.) which use “NPAPI”:http://en.wikipedia.org/wiki/NPAPI -plugin . Also JavaScripting doesn’t work with NPAPI-plugin (blaim Microsoft).
It is good practise to provide additional download link.
Check that your server actually serves correct MIME-types. “MIME Type Settings for Windows Media Services”:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/mime.asp
Copy & paste the code below to embed this comment.
Steven Price
I have used the object tag to inlcude a Flash video (.FLV) and it seems to work well. Maybe Flash video is the way to go – more people have the plug-in and progressive download means the entire file doesn’t have to be downloaded at once.
If you are using QT you need to provide alternatives which could be confusing for the user. I am not sure whether Flash video will be more accessible though – it will need more testing.
Copy & paste the code below to embed this comment.
Dave Brimlow
Strange. Both test versions wouldn’t stream in FF (on winXP) until they fully loaded, then they played fine.
But the final for standards loving browsers version actually crashed my FF; this is the very first time that my FF has crashed.
I don’t want to know why the it crashed my FF. It did. Period. I lost all my open tabs (including a lengthy, unposted, reply to someone on why their page was blowing up (because among other reasons, they had used the <embed> tag!). If the solution here crashed on me, it may crash on one of my visitors … I can’t take the risk of lost respect or patronage.
There has been a problem with replacing the damn <embed> tag with a valid “cross-browser-perform-as-intended” <object> tag for over five years now and it seems as if the problem still exists.
As a standards compliant web coder, I often wonder why I bother fighting with tableless css layout to make them cross browser compliant, when tables were simply so much easier (most likely because I resent MS arrogance). Much of the time the box model hacks don’t work as expected (or IE keeps finding a way to occasionally blow up my layout just for spite).
And now, trying to find a valid replacement for the <embed> tag is also turning into the same kind of frustrating hit or miss art project. With many brilliant mad scientists’ experiments out there that work most of the time for most of the people and some of the time for some of the people yet hardly ever for a few poor saps.
There will eventually be a true working solution. Until then, I applaud those who keep trying. So <“embed” sound of applause>. But back to the drawing board.
Copy & paste the code below to embed this comment.
Asbjørn Ulsberg
I’m having most difficulties getting Windows Media to play in Firefox, especially if I don’t want the video to autostart. There is also problems getting ASX files played among all browsers. Pointing directly to the WMV file usually works fine, but if you wrap it in an ASX file, I’ve found the content type ‘video/x-ms-asf’ to work better than the ‘video/x-ms-wmv’ proposed in this article.
And either way, I can’t find a way to display WMP’s controls in Firefox, so if you manage to get ‘autostart=0’ to be respected, there’s no way to actually start the video since there’s no play button. Frustrating.
I tried to implement this technique to embed an IFRAME content while not using the iframe element. I spent quite a few hours in doing this and came home with some results, and a lot of informations on how current UA deals with supposed standards.
If you are interested, find the post here: http://exploded.awcr.org/iframe
I’ve tried to use the <object> non ActiveX solution and worked just fine with IE 6 in WinXP. But with Firefox I could’nt make to work with the status bar. I’ve used and it didn’t work in Firefox. I’ve also tried , but it didn’t work also. This parameter didin’t work with either Firefox and IE 6, both WinXP.
Copy & paste the code below to embed this comment.
Juha Laakso
Robson,
With IE use ActiveX and with other browsers use NPAPI. And remember to use conditional comments especially since some Firefox users might have unofficial ActiveX plugin(ax in user-agent string)
Copy & paste the code below to embed this comment.
Glenn Wallace
I’m at my wits end… I have used every code I know to embed a WMV file on my splash page, yet it keeps appearing with the controller, even though I have controller=false in my code. (C:\Websites\CHLBI\chl_splash1.htm)
It works fine with my MOV page.(C:\Websites\CHLBI\chl_splash2.htm)
Copy & paste the code below to embed this comment.
Mark Wickens
<rant>
Well, I now have a hybrid of the Castro method and the Apple method….and I’m begingin to loose control of things!
All was going well – even IE 6.0.29 with SP2 under Win XP Pro was behaving (as was Safari 2.04, FF 1.5.0.8 & IE 5.2 all under Mac OS X)! Then I installed FF 2.0 under Win XP Pro – and now I’m back to square 1 with pormpts to install stuff!
It seems as soon as you fix this for one bunch of browsers, and begin testing on the next – the bubble pops. Is there a definitive version of the code structure out there will enable the embedding of MP3 files with a controller, without having to click through a thousand dialogues and sign your life away? Is it really that much to ask for?
Copy & paste the code below to embed this comment.
marcus anthony
Anyone come across the problem with scrolling embedded videos within scrollable DIVs?
I have embedded a video (youtube,google) within a scrollable DIV and upon viewing them on the mac browsers — Safari, Opera, OmniWeb and InternetExplorer, it produces an undesired effect.
Firefox seems to be an exception, but the browsers mentioned above doesn’t recognise the boundaries of the DIV. So the video is not hidden at all within the confines, and when you scroll down to view the rest of the content underneath, a ghost image of the video remains..
Here is a link for a simple demo
http://mcdxliv.cabspace.com/sample.html
The coding is straight forward. I just want to know if this is a known issue, if so are there any methods around it.. (searching the web has been to no avail). Also are PC users experiencing the same?
54 Reader Comments
Back to the ArticleJeremy Bertrand
We had a lot of problems lately with video and the latest install of Firefox (1.5.04). We were using the embed tag to display our video files and it only worked on about half of the desktops with the latest firefox install. After hunting high and low this was the fix that solved the issue. Very timely info, thanks for the fix.
Alastair Campbell
It appears that the ‘show to non-ie’ type of conditional comments were included in Hixies flash example from 2004, Lachlan’s example used a different method.
In fact, if you combine them, you could use two blocks, one for IE 5-6, and one for IE 7 & standards based browsers “like so”:http://alastairc.ac/code/ie_cc_test.html
I’m not sure what the benefit of nesting the objects is? You are effectively showing different HTML to different browsers anyway?
andris zageris
for MSJVM people have to use APPLET, otherwise see: embeding “java”:http://ww2.cs.fsu.edu/~steele/XHTML/appletObject.html via conditional comments.
also: nice js plugin “framework”:http://www.knallgrau.at/code/plugin_js
Geoff Stearns
I think the answer is not to get the embed tag added to any HTML specs, but to encourage browser makers to fix the way their browser handles the object tag. (maybe we need a browser plug-in task force?)
Until that happens (and possibly after because of things like the Eolas issue), Javascript is and will be the best way to embed any content that uses a plugin.
Paul Armstrong
Unfortunately, the Eureka! One object for Windows Media Player example did not work for me on Safari 2.0.4. Better head back to the drawing board.
Nik Outchcunis
elizabeth, this article made my month! man, i’ve been scouring the net for this answer for months now. my ad school friends entered a contest recently and asked me to embed their current.tv flash video on my blog to help get them some votes … and i reluctantly agreed knowing that it would totally ruin my perfectly valid code that i worked so hard to maintain. but your tips helped fix all my issues and now i can go back to being OCD. so thanks!
David Leader
I had noticed the Safari/Firefox conflict myself in object param markup and mounted my own examples a few months ago <http://www.q7design.demon.co.uk/QTMovieMarkup> before submitting a report to webkit. As both markups validate with the W3C validator it is not clear to me which style of object markup is correct, as I find the W3C spec. completely incomprehensible. Anyone out there understand it?
David Grudl
Few months ago I published similar way how correctly insert a Flash into XHTML (see http://www.dgx.cz/trine/item/how-to-correctly-insert-a-flash-into-xhtml). This method doesn’t require to insert any twice!
I have found out the same trick with conditional comments as Lachlan Hunt figured out, syntax-highlighed explanation is here http://www.dgx.cz/trine/item/the-magic-with-conditional-comments.
David Grudl
Sorry – now with clickable links:
– “how insert <object> into XHTML”:http://www.dgx.cz/trine/item/how-to-correctly-insert-a-flash-into-xhtml (without duplicate ‘s)
– “syntax-highlighted conditional comments trick”:http://www.dgx.cz/trine/item/the-magic-with-conditional-comments
Neil Smith
The parameter for src and controller used in the example are from WMP6.4 rather than WMP7 and later :
From WMP version 7 there was a compatibility layer put into the player to allow these elements temporarily, but it’s not guaranteed to work forever.
The src one is easy to change, it should be name=“url” instead of name=“src”. The param element for controller no longer exists, it’s replaced by uimode : One of
See these MSDN articles for complete details :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/playeruimode.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/paramtags.asp
A detailed object comparison between WMP6.4 and WMP 7 and later
http://windowssdk.msdn.microsoft.com/en-us/library/ms740077.aspx
Cheers – Neil Smith
MVP Digital Media
Harmen Janssen
Wow, two ALA articles that correspond exactly to some problems I’ve been having a while ago!
I’ve done some research on this subject myself once, but I didn’t find a standards compliant solution. Thanks a lot for providing one!
Chris Latham
If you’re looking to use QuickTime objects, I found a simple solution that uses no JavaScript or nested objects.
Elizabeth pointed out that classid is the piece of code that gives Web standards do-gooders such headaches. So, why not a little server-side if/else statement to show it to browsers that need it?
If the browser is IE, show an opening object tag that includes the classid.
Else, show an opening object tag without it.
<!—#if expr=”${HTTP_USER_AGENT} = /MSIE/”—>
<object classid=“clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” type=“video/quicktime” width=“400” height=“300” data=“videofile.mpg” standby=“Loading MPEG video…”>
<!—#else—>
<object type=“video/quicktime” width=“400” height=“300” data=“videofile.mpg” standby=“Loading MPEG video…”>
<!—#endif—>
<param name=“src” value=“videofile.mpg” />
<param name=“autoplay” value=“true” />
<param name=“controller” value=“true” />
<param name=“scale” value=“tofit” />
</object>
Works in IE Windows, Firefox Windows/Mac, Safari, and kind of works on IE Mac.
Justin Reid
This is great. I’m wondering if we can modify it so that it doesn’t use the IE conditional in the HTML. Try adding a class (“outterObject” in this example) to the parent object, and this to the global CSS file:
object { height: 0; width: 0; }
object.outterObj, object object { display: block; height: 200px; width: 320px; }
Unfortunately, IE doesn’t seem to see the nested object tag as nested, otherwise you wouldn’t need to set the default height and width values to 0 for object tags.
This of course means that you have to remove the height and width from inline on the object to the style sheet, which is a good thing, since it’s a display property anyway (and it will enable you to modify it for other media types).
I’ve only tested this for Firefox and IE6 on the PC, so I’d love to hear any feedback.
Jason Liu
A possible word of caution here: From my experience with the Flash Satay method to embed Flash movies into pages, using the <object> tag causes browsers to download the Flash movie completely before playing it, instead of being able to begin playing the movie as soon as enough of the content has been streamed in. I noticed a pause before the movie started playback in the article example… perhaps due to the same reason? All I know is that for Flash movies, with <embed>, content seems to be able to be streamed, whereas with <object>, the entire object must be downloaded before playback can begin.
In my own personal projects and in design work that I do for my clients, I tend to try to use Flash Satay as much as possible, but only when the Flash content is inconsequential to the main “meat” of the page, and is just acting as visual “icing on the cake.” When my clients demand heavy Flash content, I still have to resort to the twice-cooked method for any kind of streaming to occur. (Preloaders don’t seem to be able to counteract this effect, either.) Anyone else have any experience with regard to this?
Cecil Ward
Elizabeth asked about a variant form of the conditional comment technique which would select for non-IE/Win or certain IE/Win versions.
This should be the answer. Based on work by André Huf, Roger Johansson, Lachlan Hunt). (See “André Huf’s comment”:urlhttp://www.456bereastreet.com/archive/200511/valid_downlevelrevealed_conditional_comments/ at the foot of Roger Johansson’s article.)
Try this test example:
—
Test – valid form, Huf/Johansson: (note: IE6, IE5 should show nothing, all other browsers should show a result)
I am
<!—[if gt IE 6]><!—>
either a non-IE/Win browser, or IE/Win >6, or ancient.
<!—<![endif]—>
—
The test for IE versions can of course be reversed by changing the conditional test from gt to lt.
Note that this technique will fail for ancient IE/Win browsers <=IE4/Win.
Cecil Ward.
Cecil Ward
Alistapart rather chewed up that last example. The close-conditional comment above should have read
< ! – - <![endif] – - >
That is, a straightforward comment with an IE-conditional-close marker embedded within it.
Cecil Ward
And that too. At this point, I give up. I am indeed an idiot. And I am now going to go off and do something else instead like get some coffee, take the dogs out for a walk and feed the hens and ducks.
Elizabeth Castro
That commenting works great. In particular, one could use:
<!—[if IE gte IE 7]> <!—>
as the new initial comment just before the nested object. This limits the comments’ effect to only IE 5, 5.5, and 6 (assuming it fails in IE4, I did not test it :) and lets IE7 work properly on its own (ignoring the second object element that it does not understand).
Chris Botman
This article got me playing with Flash again, and I noticed an oddity in Firefox; the browser appears to rely on page stying to display Flash movies when only the object tag is used.
If you exclude the width and height attributes from the object tag, the movie won’t appear at all (I guess it can’t read the movie’s intrinsic values). But, even when you do set the width and height, if you turn styles off (View > Page Style > No Style), the movie will vanish.
The embed tag doesn’t suffer from this quirk, not that I’m condoning its use—but I don’t see a workaround.
Chris Botman
Just as an addendum, I’m also using the IE conditional commenting to send a unique object tag to IE and a generic tag to other browsers. I’m not nesting my object tags though, it’s literally:
<!—[if IE]>
<object />
<![endif]—>
<!—[if !IE]>—>
<object />
<!—<![endif]—>
I’m not worried about the minor code repetition, and because the offending IE object tag is entirely commented out, the page validates.
Chris Botman
Sorry to triple post, but it ate the second line of my example, which was:
<!- [if !IE]>
> <object /> <!<![endif] ->Cecil Ward
In my earlier post, I mentioned “the Huf/Johansson technique”:url:http://www.alistapart.com/comments/byebyeembed?page=3#25 for IE-Win v.x selective exclusion using valid IE-conditional directives.
I’ve done some testing using “BrowserCam”:url:http://www.browsercam.com and the technique seems very reliable. I use this technique for CSS filtering (but with additional IE/Mac filtering on top), and it’s fantastic. For the benefit of anyone who wants to use know whether they can safely take advantage of this, here’s the browsercam blitz in full.
So feel free to go for it, provided you watch out for ancient v4 browsers. See also “Roger Johansson’s article”:url:http://www.456bereastreet.com/archive/200511/valid_downlevelrevealed_conditional_comments/ and go down to “André Huf’s comment”:url:http://www.456bereastreet.com/archive/200511/valid_downlevelrevealed_conditional_comments/#comment21 .
Jacob Portnoy
As I’m currently developing an online video portal for my company, this article has been quite pertinent. Great job.
M. S.
Great article and method. However, as all my pages are XHTML Strict, this won’t validate with W3C. Also, it angers some Web Content Accessibility Guidelines.
alex messinger
This worked great for me. Our CIO had me use an .asx file with a redirect in it instead of linking directly to our streaming server. Why is that?
Christian Ziebarth
I know that within an XHTML document it is proper to type tags in lowercase but I believe that when referring to a tag (or attribute) within an article it is perfectly fine to render them in all caps. Thus . . .
“The use of embed has gone on too long.”
would be perfectly valid as
“The use of EMBED has gone on too long.”
It really helps readability for me when I am reading an article such as this. Looking forward to the sixth edition of your book, Elizabeth. Actually checked Barnes and Noble for it yesterday.
F Duchot
We are developing a filter to allow members to more easily publish youtube and other videos into our global social network. Without altering and breaking the rest of the site layout of course. This article helps considerably! Our core platform is Drupal and we plan to publish back the results once completed.
Vincent van den Heuvel
Note: “autostart” isn’t part of the QuickTime plug-in attributes, you should rather use the autoplay parameter with value true or false.
Michael Locker MD
Very useful. Mnay thanks.
Michael Locker MD
patrick lauke
through trial and error, i came up with the quicktime version ages ago for my day job’s virtual tours section http://www.salford.ac.uk/about/virtual_tour/
_ _
Great article but the whole object-in-an-object markup concept is just plain bad to me, and smells of the ol’ embed solution of olden days. Ive got a much simpler solution that works cross-browser and is xhtml compliant. Mine uses two object tag sets and display:none to hide one set based on the browser. One for IE active x and the other for all the others. Some special fixes as well, but uses simple CSS to show and hide each type for each browser. Works on MAC as well (IE and Safari), and works with Flash, Quicktime and any multimedia object you may have. Can even be used as a replacfement for the old iframe. Check it out when you get a chance and send comments:
http://www.stormdetector.com/hacks/flash_example.html
- thestormdetector
Jim C
I recently Goggled a problem I was having with the way my WMV files were opening on my site.
I found this site”¦
Ree: One object for Windows Media Player
I just used his code and IMO it works GREAT!!
“GREAT!!”? being it opens the WMV’s the way I envisioned them opening!!
http://members.shaw.ca/heis/content/content1.html
J. L
The following properties are supported for use with the name attribute of the PARAM element. “Param tags”:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/paramtags.asp All these work with IE and Media Player ActiveX plugin (the object with classid). Don’t use old deprecated Media Player 6.4 properties with Active-X plugin.
In Parentheses is specified what you should use with NPAPI-plugin ie. in second object or embed for Firefox, Opera, Safari etc.
Note also that according to specs autoStart is true by default so it is not necessary to specify it.
—- = Not supported in browsers(Firefox, Opera, Safari etc.) which use “NPAPI”:http://en.wikipedia.org/wiki/NPAPI -plugin . Also JavaScripting doesn’t work with NPAPI-plugin (blaim Microsoft).
It is good practise to provide additional download link.
Check that your server actually serves correct MIME-types. “MIME Type Settings for Windows Media Services”:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/mime.asp
Steven Price
I have used the object tag to inlcude a Flash video (.FLV) and it seems to work well. Maybe Flash video is the way to go – more people have the plug-in and progressive download means the entire file doesn’t have to be downloaded at once.
If you are using QT you need to provide alternatives which could be confusing for the user. I am not sure whether Flash video will be more accessible though – it will need more testing.
Steven
Robert Camner
The version that is supposed to work (http://alistapart.com/d/byebyeembed/forall.html) shows a completely blank page in my Safari 2.0.4.
Dave Brimlow
Strange. Both test versions wouldn’t stream in FF (on winXP) until they fully loaded, then they played fine.
But the final for standards loving browsers version actually crashed my FF; this is the very first time that my FF has crashed.
I don’t want to know why the it crashed my FF. It did. Period. I lost all my open tabs (including a lengthy, unposted, reply to someone on why their page was blowing up (because among other reasons, they had used the <embed> tag!). If the solution here crashed on me, it may crash on one of my visitors … I can’t take the risk of lost respect or patronage.
There has been a problem with replacing the damn <embed> tag with a valid “cross-browser-perform-as-intended” <object> tag for over five years now and it seems as if the problem still exists.
As a standards compliant web coder, I often wonder why I bother fighting with tableless css layout to make them cross browser compliant, when tables were simply so much easier (most likely because I resent MS arrogance). Much of the time the box model hacks don’t work as expected (or IE keeps finding a way to occasionally blow up my layout just for spite).
And now, trying to find a valid replacement for the <embed> tag is also turning into the same kind of frustrating hit or miss art project. With many brilliant mad scientists’ experiments out there that work most of the time for most of the people and some of the time for some of the people yet hardly ever for a few poor saps.
There will eventually be a true working solution. Until then, I applaud those who keep trying. So <“embed” sound of applause>. But back to the drawing board.
Asbjørn Ulsberg
I’m having most difficulties getting Windows Media to play in Firefox, especially if I don’t want the video to autostart. There is also problems getting ASX files played among all browsers. Pointing directly to the WMV file usually works fine, but if you wrap it in an ASX file, I’ve found the content type ‘video/x-ms-asf’ to work better than the ‘video/x-ms-wmv’ proposed in this article.
And either way, I can’t find a way to display WMP’s controls in Firefox, so if you manage to get ‘autostart=0’ to be respected, there’s no way to actually start the video since there’s no play button. Frustrating.
alessandro piana bianco
I tried to implement this technique to embed an IFRAME content while not using the iframe element. I spent quite a few hours in doing this and came home with some results, and a lot of informations on how current UA deals with supposed standards.
If you are interested, find the post here: http://exploded.awcr.org/iframe
Robson Waterkemper
I’ve tried to use the <object> non ActiveX solution and worked just fine with IE 6 in WinXP. But with Firefox I could’nt make to work with the status bar. I’ve used and it didn’t work in Firefox. I’ve also tried , but it didn’t work also. This parameter didin’t work with either Firefox and IE 6, both WinXP.
Juha Laakso
Robson,
With IE use ActiveX and with other browsers use NPAPI. And remember to use conditional comments especially since some Firefox users might have unofficial ActiveX plugin(ax in user-agent string)
<!—[if IE]>
<object id=“WMP” classid=“CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6” width=“320” height=“300”>
</object>
<![endif]—>
<!—[if !IE]> <—>
<object id=“WMP” type=“video/x-ms-wvx” width=“320” height=“300”>
To view the movie you need media player that supports Windows Media format
http://www.microsoft.com/windows/windowsmedia//images/logos/wmp10/Download_88×31_static.gif</a>
View / Download MyMovie (size) [WMV]
</object>
<!—> <![endif]—>
Juha Laakso
code get messed <IE]> should read < ! – - [ i f ! I E ] > without extra spaces.
Glenn Wallace
I’m at my wits end… I have used every code I know to embed a WMV file on my splash page, yet it keeps appearing with the controller, even though I have controller=false in my code. (C:\Websites\CHLBI\chl_splash1.htm)
It works fine with my MOV page.(C:\Websites\CHLBI\chl_splash2.htm)Source:
<embed src=“layout/Layout2006/Animation/CHL2.wmv” width=“600” height=“400” ‘c’, ‘’,></embed>
Any help would be GREATLY appreciated!
Glenn
Mark Wickens
<rant>
Well, I now have a hybrid of the Castro method and the Apple method….and I’m begingin to loose control of things!
All was going well – even IE 6.0.29 with SP2 under Win XP Pro was behaving (as was Safari 2.04, FF 1.5.0.8 & IE 5.2 all under Mac OS X)! Then I installed FF 2.0 under Win XP Pro – and now I’m back to square 1 with pormpts to install stuff!
It seems as soon as you fix this for one bunch of browsers, and begin testing on the next – the bubble pops. Is there a definitive version of the code structure out there will enable the embedding of MP3 files with a controller, without having to click through a thousand dialogues and sign your life away? Is it really that much to ask for?
</rant>
marcus anthony
Anyone come across the problem with scrolling embedded videos within scrollable DIVs?
I have embedded a video (youtube,google) within a scrollable DIV and upon viewing them on the mac browsers — Safari, Opera, OmniWeb and InternetExplorer, it produces an undesired effect.
Firefox seems to be an exception, but the browsers mentioned above doesn’t recognise the boundaries of the DIV. So the video is not hidden at all within the confines, and when you scroll down to view the rest of the content underneath, a ghost image of the video remains..
Here is a link for a simple demo
http://mcdxliv.cabspace.com/sample.html
The coding is straight forward. I just want to know if this is a known issue, if so are there any methods around it.. (searching the web has been to no avail). Also are PC users experiencing the same?