SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question YouTube XHTML Strict ?

    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

  2. #2
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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>

  3. #3
    .•*š draziW tnioPetiS š*•. bronze trophy
    Join Date
    Jun 2004
    Location
    "Then I figure the most good good guy will win."
    Posts
    1,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John Wozniak
    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.

    Also, this thread has some related info (i.e. the www.hillmancurtis.com JS approach.)

    Hth's,
    Cheers,
    Micky

  4. #4
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always use SWFobject for Flash content, but for some odd reason it wonīt work with youtube.

    Iīll keep searching.

  5. #5
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, Satay method?

    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>
    Which is pretty much what John Woz posted, works just fine and validates...

    Silly question, but you do realize your object has to go inside a block level element like a DIV or P, right?

  6. #6
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow
    Hello, Satay method?

    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>
    Which is pretty much what John Woz posted, works just fine and validates...
    Indeed - the only reason the code I suggested does not validate is so that it works in both standards loving browsers and IE.

    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.

  7. #7
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John Wozniak
    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.
    Uhm, I just tested - it validates just fine... If you put it in a DIV.

    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'.

  8. #8
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by deathshadow
    Silly question, but you do realize your object has to go inside a block level element like a DIV or P, right?

    -----

    Uhm, I just tested - it validates just fine... If you put it in a DIV.

    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!

    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.

  9. #9
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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>

  10. #10
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wii
    That does work and validate, the problem is that the annoying "click to activate" is still there using this method, and not in the SWFobject method, which I canīt get to work with YouTube anyway, so...oh well.

    Thanks
    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)

    If not, brings me to the inevitable question - what browser? (and if Opera, did you install the user CSS flashblock?)

  11. #11
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just edited my post - click to activate only applies for IE, but the code above fixes that.

  12. #12
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wii
    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...

    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)

  13. #13
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  14. #14
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wii
    I just edited my post - click to activate only applies for IE, but the code above fixes that.
    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.

    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

  15. #15
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  16. #16
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wii
    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.

  17. #17
    SitePoint Guru wii's Avatar
    Join Date
    Sep 2004
    Location
    Denmark
    Posts
    720
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree John, thanks for your comments.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •