Embed YouTube video – Refused to display in a frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’ [duplicate]

I am trying to feed my Django page with some resource I am getting from somewhere else.

Inside the feed, I have YouTube videos with URL like: https://www.youtube.com/watch?v=A6XUVjK9W4o

Once I added this into my page, the video does not show up, saying:

Refused to display ‘https://www.youtube.com/watch?v=A6XUVjK9W4o’ in a
frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’.

Then I said, well, what if I change watch to embed. Then YouTube player shows up, but no video, saying:

Enter code here

How can I get this to work?

I am showing it in HTML like this:

<iframe width="420" height="315"
    src="https://stackoverflow.com/questions/25661182/{{vid.yt_url}}">
</iframe>

I googled almost for an hour, but no sign of success. I tried to append &output=embed – nada…

5 Answers
5

Leave a Comment