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
Niels Møller-Hansen
2,473 PointsUnable to display embedded Youtube video on page
Hey all,
I just recently started learning HTML on this magnificent site. I have reached the stage where you learn about embedding object (ie. old youtube embed code).
As explained in the video i simply paste the code into the html body + save. However, nothing appears on my page when i refresh, which i find quite confusing since the tutorial is quite easy...
anyone have encountered the same problem, or have a possible explanation?
2 Answers
James Barnett
39,199 PointsLindsey Di Napoli & Niels Møller-Hansen
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/
austenpayan
10,218 PointsPlease post your code that you are working with to get a better idea what the issue might be?
Niels Møller-Hansen
2,473 PointsHey Austen,
It simply looks like this
<!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/LF0IhyAasWw?version=3&hl=da_DK"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="//www.youtube.com/v/LF0IhyAasWw? version=3&hl=da_DK" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</body>
</html>"
Lindsey Di Napoli
19,572 PointsLooks like there is a typo in the embed tag src:
<embed src="//www.youtube.com/v/LF0IhyAasWw? version=3&hl=da_DK"
See the space between the ? and version? It looks like that could be the issue. Good luck!
Niels Møller-Hansen
2,473 PointsHey Lindsey,
Thx, for the observation and suggestion. I tried to correct the space, but the youtube video still doesnt appear.
Lindsey Di Napoli
19,572 PointsVery odd. What browser are you using? Also, what editor?
There is also an extra " right after the closing html tag, but I don't think that should effect it.
I pasted the code you have above in jsfiddle and it is running correctly, so not sure what's happening: http://fiddle.jshell.net/Rm8mb/
Also, are you sure flash is enabled in your browser?
Niels Møller-Hansen
2,473 PointsYes, it's pretty odd indeed.
Im using Google Chrome latest edition and Sublime Text 3 (beta). The code is pasted directly from the old embed code in youtube, and it doesnt matter which ever clip i paste the code from.
And yes, flash is enabled :-S
Christel Macabeo
4,619 PointsChristel Macabeo
4,619 PointsThanks for the explanation @James Barnett. I was having the same problem. I've added the <code>http:</code> and now the youtube video appears, but I got an adobe flash security pop up. "Adobe Flash Player has stopped a potentially unsafe operation."
Niels Møller-Hansen
2,473 PointsNiels Møller-Hansen
2,473 PointsThx a ton James,
It works like a charm and makes perfect sense :)