Home » Django » embed youtube video – Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' [duplicate]

embed youtube video – Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' [duplicate]

Posted by: admin November 30, 2017 Leave a comment

Questions:

This question already has an answer here:

Answers:

Try it, please

<iframe width="420" height="315" src="https://www.youtube.com/embed/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>

Questions:
Answers:

Youtube url in src must have embed so for instance lets say you want to share this youtube video https://www.youtube.com/watch?v=P6N9782MzFQ you should use https://www.youtube.com/embed/P6N9782MzFQ as url in src‘s iframe HTML code, for example:

<iframe width="853" height="480" src="https://www.youtube.com/embed/P6N9782MzFQ" frameborder="0" allowfullscreen ng-show="showvideo"></iframe>

So just replace https://www.youtube.com/watch?v= to https://www.youtube.com/embed/ and of course check for your video’s ID in this sample my video ID is P6N9782MzFQ

Questions:
Answers:

You only need to copy from youtube Embed section (click on SHARE below the video and then EMBED and copy the entire iframe)

Questions:
Answers:

If embed no longer works for you try with /v instead.

<iframe width="420" height="315" src="https://www.youtube.com/v/A6XUVjK9W4o" frameborder="0" allowfullscreen></iframe>

Questions:
Answers:

Along with the embed, I also had to install the Google Cast extension in my browser.

<iframe width="1280" height="720" src="https://www.youtube.com/embed/4u856utdR94" frameborder="0" allowfullscreen></iframe>

Leave a Reply

Your email address will not be published. Required fields are marked *