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 trialEllen Witkowski
651 PointsVideo not displaying?
I followed the directions to upload the youtube video to my page, but it is not displaying. I'm not sure what's wrong with my code. Can someone help me out here? Code copied below.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>My Page</title> </head>
<body> <object width="420" height="315"><param name="movie" value="//www.youtube.com/v/_OBlgSz8sSM?hl=en_US&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&version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object> </body> </html>
3 Answers
Ellen Witkowski
651 PointsHi John, thanks for the quick reply. I figured out the issue. When you grab the embed code from Youtube, they don't include the http: reference in front of the URL. When I manually added that, the video previewed properly. All set here!
John Steer-Fowler
Courses Plus Student 11,734 PointsAwesome :D Yeah, your spot on. If you are trying to link to something external within your website you would need to add http://
If you are linking to an internal link then you can use the raw link
For Example: <img src="http://www.facebook.com/photo101010.php"> is external <img src="img/image1.jpg"> is internal
Just ask if you have any other questions just ask.
John Steer-Fowler
Courses Plus Student 11,734 PointsSorry, my net is going slow so I am having problems replying now :D Glad you got it solved!
James Barnett
39,199 Points>
If you are trying to link to something external within your website you would need to add http://
>
If you are linking to an internal link then you can use the raw link
You got the right answer, but for the wrong reason.
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/
John Steer-Fowler
Courses Plus Student 11,734 PointsAwesome :D Yeah, your spot on. If you are trying to link to something external within your website you would need to add http://
If you are linking to an internal link then you can use the raw link
For Example:
<img src="http://www.facebook.com/photo1010101.php"> is external
<img src="img/image1"> is internal
If you have any other questions just ask.
Ellen Witkowski
651 PointsThanks John! Just annoying that Youtube doesn't automatically add the http: like they used to! Not sure what their rationale there is. Oh well :)
James Barnett
39,199 PointsThat's called a protocol-less URL as for the reason YouTube does it ...
>
Thus, using the protocol-less URL allows a single script reference to adapt itself to whatβs most optimal: HTTP and itβs full caching support on HTTP pages, and HTTPS on secured pages so that your users arenβt confronted with a mixed content warning.
source: http://encosia.com/cripple-the-google-cdns-caching-with-a-single-character/
Larry Goodhue
4,246 PointsI had the same problem, and I figured it out finally the other day. :) I don't know why YouTube didn't include that...
James Barnett
39,199 PointsLarry Goodhue - By "that" do you mean the caveat about testing them on when developing without a web server?
John Steer-Fowler
Courses Plus Student 11,734 PointsJohn Steer-Fowler
Courses Plus Student 11,734 PointsI can't see your code. Would you be able to post the code using the Markdown Cheatsheet?
I will try and help you the best I can