My YouTube video wont show in iframe
YouTube doesn't allow 3rd parties to embed their site directly like that. Using
<iframe width="640" height="360" src="https://www.youtube.com/watch?v=ZwKhufmMxko">
</iframe>
will raise an error Refused to display 'https://www.youtube.com/watch?v=ZwKhufmMxko' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
to indicate this (you should really check the console for these things).
Fortunately Youtube offers the "embed video" option, which you need to use in order to embed videos.
Your linked video for example would produce the iframe code:
<iframe width="560" height="315" src="https://www.youtube.com/embed/ZwKhufmMxko" frameborder="0" allowfullscreen></iframe>
Change watch?v=
to embed/
The easiest way to get the correct link is to right-click
on the YouTube video and select copy embed code
.
<iframe width="854" height="480" src="https://www.youtube.com/embed/ZwKhufmMxko" frameborder="0" allowfullscreen></iframe>