I tried to embed a youtube video in my html code, but it always say that "youtube won’t allow to connect".
Here is my code:
<center><iframe src="https://www.youtube.com/embed/fcPOsBCwyu8" frameborder="0" allowfullscreen></iframe></center>
I have already used this iframe and it worked with the following code:
<center><iframe src="https://www.youtube.com/embed/ciMEdMu2s5U" frameborder="0"></iframe></center>
I saw different videos, but they just said to put the embed. I did that and I haven’t changed anything. It also gave me the following error:
Loading "https://www.youtube.com/watch?v=embed%2FqMJe-ysGx0o&feature=youtu.be" into a frame is prevented by the "X-Frame-Options" directive set to "SAMEORIGIN".
2
Answers
Videos that have this message:
Video unavailable, watch on youtube
means that the embedding of the video or in theVideo Privacy settings
, isrestricted
. It might also be related to acopyright claim
on the video.The error is a response header set by the domain from which you are requesting the resource (youtube.com in your example). They have set the header to SAMEORIGIN in this case, which means that they have disallowed loading of the resource in an iframe outside of their domain. For more information see The X-Frame-Options response header on MDN.