Is it possible to insert a YouTube movie in a valid XHTML 1.0 Strict page ? Iīve tried, but if it validates it doesnīt work, any ideas ?
Thanks
| SitePoint Sponsor |
Is it possible to insert a YouTube movie in a valid XHTML 1.0 Strict page ? Iīve tried, but if it validates it doesnīt work, any ideas ?
Thanks
No it won't validate - this is as close as you can get for something that works cross browser:
HTML Code:<object type="application/x-shockwave-flash" data="http://www.youtube.com/your-video" width="425" height="350"><param name="movie" value="http://www.youtube.com/your-video" /></object>
For a JS solution, see SWFobject. Here is an XHTML 1.0 strict example.Originally Posted by John Wozniak
Also, this thread has some related info (i.e. the www.hillmancurtis.com JS approach.)
Hth's,
Cheers,
Micky
I always use SWFobject for Flash content, but for some odd reason it wonīt work with youtube.
Iīll keep searching.
Hello, Satay method?
Which is pretty much what John Woz posted, works just fine and validates...Code:<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/your_video" width="425" height="350" > <param name="movie" value="http://www.youtube.com/v/your_video" /> <param name="wmode" value="transparent" /> </object>
Silly question, but you do realize your object has to go inside a block level element like a DIV or P, right?
Indeed - the only reason the code I suggested does not validate is so that it works in both standards loving browsers and IE.Originally Posted by deathshadow
Two things I prefer about the method I suggested (not to your suggestion DS which is essentially the same - just generally speaking):
1. The code is uncomplicated and all "in the page"
2. The code works across browsers
3. The code requires no JS or additional Flash movies
4. Although the code does not validate, I insert the code aware of this and that I am making a compromise and it doesn't bother me that the page doesn't validate - this is the browser maker's fault, not mine.
Being hell bent on validation, even when it is not practical, reminds me of those that try to use CSS and lists to replace tables for tabular data display - you are not more of a web developer if you choose a more complicated method - you are just a less practical one.
Uhm, I just tested - it validates just fine... If you put it in a DIV.Originally Posted by John Wozniak
Remember, object is considered an inline - raw inlines are invalid XHTML... all inlines MUST go inside a block level to validate.
You leave it without a container, you get the classic 'inline must be inside a block level like H1, H2, DIV, etc'.
Perfecto!Originally Posted by deathshadow
I actually don't have any of these videos in any of my "real" pages so I am just winging it (hence the standalone code) - the point I was making about validation is that sometimes people get so set on it that it impedes them from thinking practically.
In a "real" page the video would likely be contained be a block level element so this would have never come up.
Got it !
Adobeīs own solution validates XHTML Strict 1.0 and removes the "click to activate" in IE. Works in all browsers according to Browsercam, yes, even IE 4 and Netscape 4.
http://www.adobe.com/devnet/activeco...devletter.html
Example code for YouTube:
Code:<script src="AC_RunActiveContent.js" type="text/javascript"></script> <script type="text/javascript" > AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','425','height','350','src','http://www.youtube.com/v/qC_-Nx2CWR4','quality','high','bgcolor','#000066','name','youtube','allowscriptaccess','sameDomain','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','http://www.youtube.com/v/qC_-Nx2CWR4' );</script>
Click to activate? Not getting that here... Do you mean you want it to autoplay? if so, just add &autoplay=1 to the end of your video url. (in both places)Originally Posted by wii
If not, brings me to the inevitable question - what browser? (and if Opera, did you install the user CSS flashblock?)
I just edited my post - click to activate only applies for IE, but the code above fixes that.
Yeah, just occurred to me it was IE only - I completely forgot it does that...Originally Posted by wii
But then, I don't usually use flash on websites - and haven't used IE to actually browse in... four years? (strictly compat testing at this point)
Well, I like this so much that I released as a vBulletin modification if anyone needs it:
http://www.vbulletin.org/forum/showthread.php?t=133143
Thanks
You did not mention this earlier so I thought it didn't matter to you - the Eolas dispute and its result is old news to most Flash developers, as is Macradobe's suggested fix.Originally Posted by wii
What is most irksome about all the hoops that you (meaning anyone) must jump through for IE, is that in regards to this particular issue, if MS didn't create and utilize ActiveX we would be able to use the same, super simple code across the board - one can dream! One more strike against MS and the effect their business practices have on our work.
Most important thing is that you found a solution that you are comfortable with - sounds like you got that.
All the best,
John
Yeah, itīs annoying what happened to Microsoft and IE, but Iīm not interested in politics, I always do whatīs best for my users, and since most people on my sites and forums use IE, I have to fix it, I myself always use Firefox.
In any case Adobe's solution to this is perfect.
I hear ya - sounds like you are making a good choice - as far as I am concerned these IE issues (created by the fact that IE is the 800lb gorilla everyone wants to take shots at as a result of its huge market share) are just annoying not political, at least on the level with which I have to deal with them.Originally Posted by wii
I agree John, thanks for your comments.
Bookmarks