Go Back   SitePoint Forums > Forum Index > Design Your Site > Web Page Design > HTML and XHTML
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Dec 2, 2006, 15:41   #1
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
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
wii is offline   Reply With Quote
Old Dec 2, 2006, 17:42   #2
brandaggio
Brevity is greatly overrated
 
brandaggio's Avatar
 
Join Date: Dec 2005
Posts: 1,419
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>
brandaggio is offline   Reply With Quote
Old Dec 3, 2006, 01:46   #3
mhulse
.•*š draziW tnioPetiS š*•.
 
Join Date: Jun 2004
Location: "Then I figure the most good good guy will win."
Posts: 1,606
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
mhulse is offline   Reply With Quote
Old Dec 3, 2006, 06:04   #4
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
I always use SWFobject for Flash content, but for some odd reason it wonīt work with youtube.

Iīll keep searching.
wii is offline   Reply With Quote
Old Dec 3, 2006, 08:07   #5
deathshadow
Non-Member
 
deathshadow's Avatar
 
Join Date: Jul 2006
Location: Dublin, NH
Posts: 901
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?
deathshadow is offline   Reply With Quote
Old Dec 3, 2006, 09:42   #6
brandaggio
Brevity is greatly overrated
 
brandaggio's Avatar
 
Join Date: Dec 2005
Posts: 1,419
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.
brandaggio is offline   Reply With Quote
Old Dec 3, 2006, 10:13   #7
deathshadow
Non-Member
 
deathshadow's Avatar
 
Join Date: Jul 2006
Location: Dublin, NH
Posts: 901
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'.
deathshadow is offline   Reply With Quote
Old Dec 3, 2006, 11:53   #8
brandaggio
Brevity is greatly overrated
 
brandaggio's Avatar
 
Join Date: Dec 2005
Posts: 1,419
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.
brandaggio is offline   Reply With Quote
Old Dec 3, 2006, 12:18   #9
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
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>
wii is offline   Reply With Quote
Old Dec 3, 2006, 12:35   #10
deathshadow
Non-Member
 
deathshadow's Avatar
 
Join Date: Jul 2006
Location: Dublin, NH
Posts: 901
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?)
deathshadow is offline   Reply With Quote
Old Dec 3, 2006, 12:40   #11
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
I just edited my post - click to activate only applies for IE, but the code above fixes that.
wii is offline   Reply With Quote
Old Dec 3, 2006, 13:07   #12
deathshadow
Non-Member
 
deathshadow's Avatar
 
Join Date: Jul 2006
Location: Dublin, NH
Posts: 901
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)
deathshadow is offline   Reply With Quote
Old Dec 3, 2006, 13:47   #13
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
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
wii is offline   Reply With Quote
Old Dec 3, 2006, 13:48   #14
brandaggio
Brevity is greatly overrated
 
brandaggio's Avatar
 
Join Date: Dec 2005
Posts: 1,419
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
brandaggio is offline   Reply With Quote
Old Dec 3, 2006, 13:52   #15
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
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.
wii is offline   Reply With Quote
Old Dec 3, 2006, 13:58   #16
brandaggio
Brevity is greatly overrated
 
brandaggio's Avatar
 
Join Date: Dec 2005
Posts: 1,419
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.
brandaggio is offline   Reply With Quote
Old Dec 5, 2006, 02:26   #17
wii
SitePoint Guru
 
wii's Avatar
 
Join Date: Sep 2004
Location: Denmark
Posts: 717
I agree John, thanks for your comments.
wii is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 14:44.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved