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 trialEndrin Tushe
4,591 PointsOld embed option no longer available on Youtube
It seems that YouTube no longer has the old embed check box option. They now use iframe element.
If I just cut and paste that code into Textmate the video embed won't work. I found that by adding http: in front of the address will make the code work. Reading previous posts it seems that the reason why the original code doesn't work is because the site is locally hosted. So my question is if the site wasn't locally hosted would we just copy the "iframe"embed code from youtube and not worry about adding the http: or should we always add http: to be on the safe side?
3 Answers
Marcus Parsons
15,719 PointsAdding "http:" to the beginning is a safe bet. The problem is, as you said yourself, when you run the program locally, the browser doesn't know how to handle the address being given. This is because you aren't using a server to execute a client-server transaction. If you were to run the code on your localhost using an Apache server (or any other server you choose), the "http:" would be prepended to the "//youtube.com..." address. Without the forced "http:" on the link, though, the target website (Youtube) can choose to initialize another type of connection, such as "https:". Leaving the forced "http:" off of the link allows the target website more freedom to choose the type of connection it wishes to establish. I hope that makes sense.
Endrin Tushe
4,591 PointsThanks for the reply Marcus! This is very helpful!
Marcus Parsons
15,719 PointsYou are more than welcome, my friend! Good luck in your future endeavors. :)
Travon McCray
1,476 Pointsi went to this website - http://www.gorissen.info/Pierre/files/YouTube_code.htm it has embedded code that by using the url of the youtube video and generating an old embedded code.
Sara Read
10,476 PointsSara Read
10,476 PointsThanks so much! Such a simple fix. :)
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsYou're welcome, Sara! =]