Dave Heavy Industries Dave Heavy Industries – blog

11Mar/111

Youtube – Embed video on HTTPS site

Ever wanted to embed a youtube video on a https (SSL) site without a security warning?

Well, its really quite easy. Youtube were kind enough to re-work their embed method from an <object> to an <iframe></iframe> and now fully support HTTPS.

very simply, here's the html you need.

<iframe title="YouTube video player" width="1280" height="750" src="https://www.youtube.com/embed/XXXXXXXXXXXXXXXX?rel=0&amp;hd=1" frameborder="0" allowfullscreen></iframe>

XXXXXXXXXXXXXXXX - embed ID of the video. you can see this in the URL of the youtube video

https -  http or https, depending on if you're embedding from a HTTPS page or not (if the page is accessible via both http and https, use https to avoid an IE security warning)

?rel=0 - realated videos.. 0 = none, exclude or =1 for allow

hd=1 - high definition.. 1 = high def, 0 (or exclude) = standard

1280 - width (1280px in this case.. you probably want it smaller)

750 - height (750px in this case.. you probably want it smaller)

allowfullscreen - exclude if you don't want your users to be able to make fullscreen (self explanatory really)

 

Comments (1) Trackbacks (0)
  1. Thanks a lot!!! You were the only one, qho helped me with my https problem.
    It works great with all browsers!
    Thanks again.


Leave a comment

No trackbacks yet.