The easiest way to embed a YouTube video in another webpage is to use Share > Embed, found on any YouTube video page.
YouTube has recently made a slight modification to this code by removing the protocol (http:) at the beginning of the URL:
<iframe width="560" height="315" src="//www.youtube.com/embed/CBfVgQNKa5s" frameborder="0" allowfullscreen></iframe>
In many respects, this an improvement. The lack of a a protocol means that this link will inherit the protocol from its container page. So if the container page is https (a secure page), the YouTube video will be as well. This avoids a security warning to IE users when loading unsecured content (the http YouTube video) within a secured (https) webpage. This is a more flexible method, as long as your page is on a web server.
However, it means that the embedded content will not preview locally from your hard drive.
To view a working embed from you local drive, modify the embed so that the src attribute begins with http:
<iframe width="560" height="315" src="http://www.youtube.com/embed/CBfVgQNKa5s" frameborder="0" allowfullscreen></iframe>
The same protocol policy goes for URLs used with Google’s Hosted Libraries (like jQuery).
Get updates from Ajar Productions
Sign up today and get the InDesign Split Text premium extension for free!
Comments are closed. Still have questions?
Contact Ajar