Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

alex mattingley
alex mattingley
7,508 Points

Embeded Question

I am working through the deep dives for HTML and I am working on the part where you embed a youtube video into the site.

I am Having some issues getting a video to pop up on my web page and I am not sure why. I went to the video and got the code from youtube and posted it directly into my html document like so:

<object width="420" height="315"><param name="movie" value="//www.youtube.com/v/_OBlgSz8sSM?hl=en_US&amp;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="//www.youtube.com/v/_OBlgSz8sSM?hl=en_US&amp;version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

But for some reason it is still not working. Do I need to add any tags or anything to get it to appear?

3 Answers

Hi Alex, At a quick glance I've noticed you're missing the Hypertext Transfer Protocol (http:) in front of your YouTube URLs. Once you've added the http: in front of the double forward slashes //, your video should show up.

<object width="420" height="315">
    <param name="movie" value="http://www.youtube.com/v/_OBlgSz8sSM"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed src="http://www.youtube.com/v/_OBlgSz8sSM" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
alex mattingley
alex mattingley
7,508 Points

Yea, I realized that yesterday. The code above was directly posted from youtube. Did they leave out the HTTP out intentionally?

I'm sure there's a reason, but honestly have no idea why they would leave the http: out if there was a reason to.

alex mattingley
alex mattingley
7,508 Points

I emailed them but I got no response :(

I had a similar problem also, i like to modify the example a little bit when im watching the video to get a better grasp on what im learning so i tried embedding a different video. I added the (http:) to the begging of the src and still nothing, i know its not my browser or version of adobe because when i copy and paste the code from the above answer it works. any help is appreciated!

<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/uL37RDS2Qiw?hl=en_US&amp;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="//www.youtube.com/v/uL37RDS2Qiw?hl=en_US&amp;version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/uL37RDS2Qiw?hl=en_US&amp;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="//www.youtube.com/v/uL37RDS2Qiw?hl=en_US&amp;version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

now im having trouble copy and pasting my code

Found my solution! didn't realize there were two src elements you had to add (http:) to

alex mattingley
alex mattingley
7,508 Points

yea, its super weird and mildly irritating

James Barnett
James Barnett
39,199 Points

Steven Gassert & alex mattingley -

Protocol-less URLs don't work without a web server, so in that case just add http: in front of the URL.

The main caveat to keep in mind when using the protocol-less reference is that it will fail on pages loaded via file:/// (i.e. HTML pages you load directly from disk to your browser). So, do be sure to include the http: protocol in the URL if you happen to be developing without a web server at all, but don’t worry about omitting it otherwise.

source: http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/